mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Due Dates fully functional
Today list fully functional New and edit task dialog now goes full screen on smaller screens, stays as a pop-up on bigger ones New Alarm icon on expired tasks Better tasks layout Simpler new and edit task form layout: less labels, replaced radiogroup with slider,...
This commit is contained in:
@@ -11,6 +11,7 @@ import android.support.design.widget.TabLayout;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
@@ -27,7 +28,6 @@ import com.wismna.geoffroy.donext.adapters.SmartFragmentStatePagerAdapter;
|
|||||||
import com.wismna.geoffroy.donext.adapters.TaskRecyclerViewAdapter;
|
import com.wismna.geoffroy.donext.adapters.TaskRecyclerViewAdapter;
|
||||||
import com.wismna.geoffroy.donext.dao.Task;
|
import com.wismna.geoffroy.donext.dao.Task;
|
||||||
import com.wismna.geoffroy.donext.dao.TaskList;
|
import com.wismna.geoffroy.donext.dao.TaskList;
|
||||||
import com.wismna.geoffroy.donext.database.TaskDataAccess;
|
|
||||||
import com.wismna.geoffroy.donext.database.TaskListDataAccess;
|
import com.wismna.geoffroy.donext.database.TaskListDataAccess;
|
||||||
import com.wismna.geoffroy.donext.fragments.TaskDialogFragment;
|
import com.wismna.geoffroy.donext.fragments.TaskDialogFragment;
|
||||||
import com.wismna.geoffroy.donext.fragments.TasksFragment;
|
import com.wismna.geoffroy.donext.fragments.TasksFragment;
|
||||||
@@ -51,11 +51,13 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
|||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private List<TaskList> taskLists;
|
private List<TaskList> taskLists;
|
||||||
|
private boolean mIsLargeLayout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
mIsLargeLayout = getResources().getBoolean(R.bool.large_layout);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@@ -142,6 +144,7 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
MenuItem item = menu.findItem(R.id.action_changeLayout);
|
MenuItem item = menu.findItem(R.id.action_changeLayout);
|
||||||
|
if (item == null) return false;
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
String layoutType = sharedPref.getString("pref_conf_task_layout", "1");
|
String layoutType = sharedPref.getString("pref_conf_task_layout", "1");
|
||||||
switch (layoutType) {
|
switch (layoutType) {
|
||||||
@@ -183,17 +186,28 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
|||||||
/** Called when user clicks on the New Task floating button */
|
/** Called when user clicks on the New Task floating button */
|
||||||
public void onNewTaskClick(View view) {
|
public void onNewTaskClick(View view) {
|
||||||
int currentTabPosition = mViewPager.getCurrentItem();
|
int currentTabPosition = mViewPager.getCurrentItem();
|
||||||
FragmentManager manager = getSupportFragmentManager();
|
|
||||||
TaskDialogFragment taskDialogFragment = TaskDialogFragment.newInstance(null,
|
TaskDialogFragment taskDialogFragment = TaskDialogFragment.newInstance(null,
|
||||||
mSectionsPagerAdapter.getAllItems(),
|
mSectionsPagerAdapter.getAllItems(),
|
||||||
(TasksFragment) mSectionsPagerAdapter.getRegisteredFragment(currentTabPosition));
|
(TasksFragment) mSectionsPagerAdapter.getRegisteredFragment(currentTabPosition));
|
||||||
|
|
||||||
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
// Set current tab value to new task dialog
|
// Set current tab value to new task dialog
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt("list", currentTabPosition);
|
args.putInt("list", currentTabPosition);
|
||||||
taskDialogFragment.setArguments(args);
|
taskDialogFragment.setArguments(args);
|
||||||
|
|
||||||
taskDialogFragment.show(manager, "Create new task");
|
if (mIsLargeLayout)
|
||||||
|
taskDialogFragment.show(fragmentManager, getString(R.string.action_new_task));
|
||||||
|
else {
|
||||||
|
// The device is smaller, so show the fragment fullscreen
|
||||||
|
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||||
|
// For a little polish, specify a transition animation
|
||||||
|
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||||
|
// To make it fullscreen, use the 'content' root view as the container
|
||||||
|
// for the fragment, which is always the root view for the activity
|
||||||
|
transaction.replace(android.R.id.content, taskDialogFragment)
|
||||||
|
.addToBackStack(null).commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when the user clicks on the Change Layout button */
|
/** Called when the user clicks on the Change Layout button */
|
||||||
@@ -270,11 +284,6 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
|||||||
}
|
}
|
||||||
if (!todayList.isVisible())
|
if (!todayList.isVisible())
|
||||||
taskListDataAccess.updateVisibility(todayList.getId(), true);
|
taskListDataAccess.updateVisibility(todayList.getId(), true);
|
||||||
// Mark all tasks with an earlier do date as done
|
|
||||||
try (TaskDataAccess taskDataAccess = new TaskDataAccess(this, TaskDataAccess.MODE.WRITE)) {
|
|
||||||
taskDataAccess.updateExpiredTasks(
|
|
||||||
Integer.valueOf(sharedPref.getString("pref_conf_today_action", "2")), todayList.getId());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Hide the today list if it exists
|
// Hide the today list if it exists
|
||||||
if (todayList != null) {
|
if (todayList != null) {
|
||||||
@@ -298,7 +307,9 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
|||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
// getItem is called to instantiate the fragment for the given page.
|
// getItem is called to instantiate the fragment for the given page.
|
||||||
// Return a PlaceholderFragment (defined as a static inner class below).
|
// Return a PlaceholderFragment (defined as a static inner class below).
|
||||||
return TasksFragment.newInstance(taskLists.get(position).getId(), MainActivity.this);
|
TaskList taskList = taskLists.get(position);
|
||||||
|
return TasksFragment.newInstance(taskList.getId(),
|
||||||
|
taskList.getName().equals(getString(R.string.task_list_today)), MainActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -6,11 +6,14 @@ import android.support.v7.widget.RecyclerView;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.wismna.geoffroy.donext.R;
|
import com.wismna.geoffroy.donext.R;
|
||||||
import com.wismna.geoffroy.donext.dao.Task;
|
import com.wismna.geoffroy.donext.dao.Task;
|
||||||
|
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +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()))
|
||||||
|
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm_black_24dp);
|
||||||
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());
|
||||||
if (holder instanceof DetailedViewHolder)
|
if (holder instanceof DetailedViewHolder)
|
||||||
@@ -112,21 +117,22 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SimpleViewHolder extends RecyclerView.ViewHolder {
|
class SimpleViewHolder extends RecyclerView.ViewHolder {
|
||||||
public final View mView;
|
final View mView;
|
||||||
public final TextView mIdView;
|
final TextView mIdView;
|
||||||
public final TextView mCycleView;
|
final ImageView mAlarmView;
|
||||||
public final TextView mTitleView;
|
final TextView mCycleView;
|
||||||
public Task mItem;
|
final TextView mTitleView;
|
||||||
|
Task mItem;
|
||||||
|
|
||||||
public SimpleViewHolder(View view) {
|
SimpleViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
mView = view;
|
mView = view;
|
||||||
|
|
||||||
mIdView = (TextView) view.findViewById(R.id.task_id);
|
mIdView = (TextView) view.findViewById(R.id.task_id);
|
||||||
|
mAlarmView = (ImageView) view.findViewById(R.id.task_alarm);
|
||||||
mCycleView = (TextView) view.findViewById(R.id.task_cycle);
|
mCycleView = (TextView) view.findViewById(R.id.task_cycle);
|
||||||
mTitleView = (TextView) view.findViewById(R.id.task_name);
|
mTitleView = (TextView) view.findViewById(R.id.task_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -135,10 +141,10 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DetailedViewHolder extends SimpleViewHolder {
|
private class DetailedViewHolder extends SimpleViewHolder {
|
||||||
public final TextView mDescriptionView;
|
private final TextView mDescriptionView;
|
||||||
|
|
||||||
public DetailedViewHolder(View view) {
|
private DetailedViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
mDescriptionView = (TextView) view.findViewById(R.id.task_description);
|
mDescriptionView = (TextView) view.findViewById(R.id.task_description);
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,10 @@ import android.database.Cursor;
|
|||||||
import android.database.SQLException;
|
import android.database.SQLException;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import com.wismna.geoffroy.donext.R;
|
|
||||||
import com.wismna.geoffroy.donext.dao.Task;
|
import com.wismna.geoffroy.donext.dao.Task;
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -34,18 +31,12 @@ public class TaskDataAccess implements AutoCloseable {
|
|||||||
DatabaseHelper.TASKS_COLUMN_CYCLE, DatabaseHelper.TASKS_COLUMN_DONE,
|
DatabaseHelper.TASKS_COLUMN_CYCLE, DatabaseHelper.TASKS_COLUMN_DONE,
|
||||||
DatabaseHelper.TASKS_COLUMN_DELETED, DatabaseHelper.TASKS_COLUMN_LIST,
|
DatabaseHelper.TASKS_COLUMN_DELETED, DatabaseHelper.TASKS_COLUMN_LIST,
|
||||||
DatabaseHelper.TASKS_COLUMN_DUEDATE};
|
DatabaseHelper.TASKS_COLUMN_DUEDATE};
|
||||||
private List<String> priorities = new ArrayList<>();
|
|
||||||
|
|
||||||
public TaskDataAccess(Context context) {
|
public TaskDataAccess(Context context) {
|
||||||
this(context, MODE.READ);
|
this(context, MODE.READ);
|
||||||
}
|
}
|
||||||
public TaskDataAccess(Context context, MODE writeMode) {
|
public TaskDataAccess(Context context, MODE writeMode) {
|
||||||
dbHelper = new DatabaseHelper(context);
|
dbHelper = new DatabaseHelper(context);
|
||||||
|
|
||||||
priorities.add(context.getString(R.string.new_task_priority_low));
|
|
||||||
priorities.add(context.getString(R.string.new_task_priority_normal));
|
|
||||||
priorities.add(context.getString(R.string.new_task_priority_high));
|
|
||||||
|
|
||||||
open(writeMode);
|
open(writeMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,19 +50,16 @@ 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, String priority, long taskList) {
|
public Task createOrUpdateTask(long id, String name, String description, int priority, long taskList) {
|
||||||
return createOrUpdateTask(id, name, description, priority, taskList, LocalDate.now());
|
return createOrUpdateTask(id, name, description, priority, taskList, LocalDate.now());
|
||||||
}
|
}
|
||||||
public Task createOrUpdateTask(long id, String name, String description, String priority, long taskList, LocalDate date) {
|
public Task createOrUpdateTask(long id, String name, String description, int priority, long taskList, LocalDate date) {
|
||||||
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, priorities.indexOf(priority));
|
values.put(DatabaseHelper.TASKS_COLUMN_PRIORITY, priority);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_LIST, taskList);
|
values.put(DatabaseHelper.TASKS_COLUMN_LIST, taskList);
|
||||||
DateFormat sdf = SimpleDateFormat.getDateInstance();
|
values.put(DatabaseHelper.TASKS_COLUMN_DUEDATE, date.toString());
|
||||||
//SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD", Locale.US);
|
|
||||||
String dateString = sdf.format(date);
|
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_DUEDATE, dateString);
|
|
||||||
long insertId;
|
long insertId;
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
insertId = database.insert(DatabaseHelper.TASKS_TABLE_NAME, null, values);
|
insertId = database.insert(DatabaseHelper.TASKS_TABLE_NAME, null, values);
|
||||||
@@ -98,8 +86,8 @@ public class TaskDataAccess implements AutoCloseable {
|
|||||||
ContentValues contentValues = new ContentValues();
|
ContentValues contentValues = new ContentValues();
|
||||||
contentValues.put(column, 1);
|
contentValues.put(column, 1);
|
||||||
return database.update(DatabaseHelper.TASKS_TABLE_NAME, contentValues,
|
return database.update(DatabaseHelper.TASKS_TABLE_NAME, contentValues,
|
||||||
DatabaseHelper.TASKS_COLUMN_DUEDATE + " < date('now','-1 day') " +
|
DatabaseHelper.TASKS_COLUMN_DUEDATE + " <= date('now','-1 day')" +
|
||||||
"AND " + DatabaseHelper.TASKS_COLUMN_LIST + " = " + taskListId, null);
|
" AND " + DatabaseHelper.TASKS_COLUMN_LIST + " = " + taskListId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Task> getAllTasks(long id) {
|
public List<Task> getAllTasks(long id) {
|
||||||
|
@@ -1,19 +1,25 @@
|
|||||||
package com.wismna.geoffroy.donext.fragments;
|
package com.wismna.geoffroy.donext.fragments;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
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.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.SeekBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import com.wismna.geoffroy.donext.R;
|
import com.wismna.geoffroy.donext.R;
|
||||||
@@ -59,17 +65,25 @@ public class TaskDialogFragment extends DialogFragment {
|
|||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
View view = inflater.inflate(R.layout.fragment_task_form, container, false);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
||||||
// Get the layout inflater
|
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
|
||||||
View view = inflater.inflate(R.layout.fragment_task_form, null);
|
|
||||||
|
|
||||||
|
Toolbar toolbar = (Toolbar) view.findViewById(R.id.new_task_toolbar);
|
||||||
|
|
||||||
|
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
actionBar.setHomeAsUpIndicator(android.R.drawable.ic_menu_close_clear_cancel);
|
||||||
|
}
|
||||||
|
setHasOptionsMenu(true);
|
||||||
// Inflate and set the layout for the dialog
|
// Inflate and set the layout for the dialog
|
||||||
// Pass null as the parent view because its going in the dialog layout
|
// Pass null as the parent view because its going in the dialog layout
|
||||||
builder.setView(view)
|
/*builder.setView(view)
|
||||||
// Add action buttons
|
// Add action buttons
|
||||||
.setPositiveButton(R.string.new_task_save, null)
|
.setPositiveButton(R.string.new_task_save, null)
|
||||||
.setNegativeButton(R.string.new_task_cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.new_task_cancel, new DialogInterface.OnClickListener() {
|
||||||
@@ -78,15 +92,10 @@ public class TaskDialogFragment extends DialogFragment {
|
|||||||
// Canceled creation, nothing to do
|
// Canceled creation, nothing to do
|
||||||
TaskDialogFragment.this.getDialog().cancel();
|
TaskDialogFragment.this.getDialog().cancel();
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
// Get date picker
|
// Get date picker
|
||||||
final DatePicker dueDatePicker = (DatePicker) view.findViewById(R.id.new_task_due_date);
|
final DatePicker dueDatePicker = (DatePicker) view.findViewById(R.id.new_task_due_date);
|
||||||
// Disallow past dates
|
|
||||||
dueDatePicker.setMinDate(LocalDate.now().toDate().getTime());
|
|
||||||
// TODO: set task due date
|
|
||||||
LocalDate dueDate = task.getDueDate();
|
|
||||||
dueDatePicker.updateDate(dueDate.getYear(), dueDate.getMonthOfYear(), dueDate.getDayOfMonth());
|
|
||||||
|
|
||||||
// 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);
|
||||||
@@ -100,14 +109,17 @@ public class TaskDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
// Set due date
|
// Set due date
|
||||||
dueDatePicker.setEnabled(!taskLists.get(position).getName()
|
boolean isRestricted = taskLists.get(position).getName()
|
||||||
.equals(getString(R.string.task_list_today)));
|
.equals(getString(R.string.task_list_today));
|
||||||
|
dueDatePicker.setEnabled(!isRestricted);
|
||||||
|
if (isRestricted) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
dueDatePicker.updateDate(today.getYear(), today.getMonthOfYear() - 1, today.getDayOfMonth());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auto set list value to current tab
|
// Auto set list value to current tab
|
||||||
@@ -117,42 +129,52 @@ public class TaskDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
// Set other properties if they exist
|
// Set other properties if they exist
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
|
toolbar.setTitle(R.string.action_edit_task);
|
||||||
|
|
||||||
EditText titleText = (EditText) view.findViewById(R.id.new_task_name);
|
EditText titleText = (EditText) view.findViewById(R.id.new_task_name);
|
||||||
titleText.setText(task.getName());
|
titleText.setText(task.getName());
|
||||||
EditText descText = (EditText) view.findViewById(R.id.new_task_description);
|
EditText descText = (EditText) view.findViewById(R.id.new_task_description);
|
||||||
descText.setText(task.getDescription());
|
descText.setText(task.getDescription());
|
||||||
RadioGroup priorityGroup = (RadioGroup) view.findViewById(R.id.new_task_priority);
|
SeekBar seekBar = (SeekBar) view.findViewById(R.id.new_task_priority);
|
||||||
switch (task.getPriority()) {
|
seekBar.setProgress(task.getPriority());
|
||||||
case 0:
|
|
||||||
priorityGroup.check(R.id.new_task_priority_low);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
priorityGroup.check(R.id.new_task_priority_normal);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
priorityGroup.check(R.id.new_task_priority_high);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.setNeutralButton(R.string.new_task_delete, new DialogInterface.OnClickListener() {
|
// Set Due Date
|
||||||
|
LocalDate dueDate = task.getDueDate();
|
||||||
|
dueDatePicker.updateDate(dueDate.getYear(), dueDate.getMonthOfYear() - 1, dueDate.getDayOfMonth());
|
||||||
|
|
||||||
|
// Add the Delete button
|
||||||
|
/* builder.setNeutralButton(R.string.new_task_delete, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
mListener.onNewTaskDialogNeutralClick(TaskDialogFragment.this);
|
mListener.onNewTaskDialogNeutralClick(TaskDialogFragment.this);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Light);
|
|
||||||
}
|
}
|
||||||
return builder.create();
|
else {
|
||||||
|
toolbar.setTitle(R.string.action_new_task);
|
||||||
|
// Disallow past dates on new tasks
|
||||||
|
dueDatePicker.setMinDate(LocalDate.now().toDate().getTime());
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NonNull
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
final AlertDialog d = (AlertDialog) getDialog();
|
final Dialog d = (Dialog) getDialog();
|
||||||
if(d != null)
|
if(d != null)
|
||||||
{
|
{
|
||||||
Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
|
//d.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
/*Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
|
||||||
positiveButton.setOnClickListener(new View.OnClickListener()
|
positiveButton.setOnClickListener(new View.OnClickListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -168,10 +190,58 @@ public class TaskDialogFragment extends DialogFragment {
|
|||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
//super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
menu.clear();
|
||||||
|
getActivity().getMenuInflater().inflate(R.menu.menu_new_task, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
|
if (task == null) {
|
||||||
|
menu.removeItem(R.id.menu_new_task_delete);
|
||||||
|
}
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.menu_new_task_save) {
|
||||||
|
EditText titleText = (EditText) getDialog().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);
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (id == R.id.menu_new_task_delete) {
|
||||||
|
// handle confirmation button click here
|
||||||
|
mListener.onNewTaskDialogNeutralClick(TaskDialogFragment.this);
|
||||||
|
dismiss();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (id == android.R.id.home) {
|
||||||
|
// handle close button click here
|
||||||
|
dismiss();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
Dialog dialog = getDialog();
|
Dialog dialog = getDialog();
|
||||||
|
@@ -10,6 +10,7 @@ import android.support.design.widget.Snackbar;
|
|||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
@@ -20,8 +21,7 @@ import android.view.ViewTreeObserver;
|
|||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioButton;
|
import android.widget.SeekBar;
|
||||||
import android.widget.RadioGroup;
|
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -45,13 +45,16 @@ public class TasksFragment extends Fragment implements
|
|||||||
TaskDialogFragment.NewTaskListener,
|
TaskDialogFragment.NewTaskListener,
|
||||||
ConfirmDialogFragment.ConfirmDialogListener,
|
ConfirmDialogFragment.ConfirmDialogListener,
|
||||||
TaskTouchHelper.TaskTouchHelperAdapter {
|
TaskTouchHelper.TaskTouchHelperAdapter {
|
||||||
|
|
||||||
public interface TaskChangedAdapter {
|
public interface TaskChangedAdapter {
|
||||||
void onTaskListChanged(Task task, int tabPosition);
|
void onTaskListChanged(Task task, int tabPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String TASK_LIST_ID = "task_list_id";
|
private static final String TASK_LIST_ID = "task_list_id";
|
||||||
|
private static final String CLEAR_EXPIRED_TASKS = "clear_expired_tasks";
|
||||||
private long taskListId = -1;
|
private long taskListId = -1;
|
||||||
//private TaskDataAccess taskDataAccess;
|
private boolean clearExpiredTasks = false;
|
||||||
|
private boolean mIsLargeLayout;
|
||||||
private TaskRecyclerViewAdapter taskRecyclerViewAdapter;
|
private TaskRecyclerViewAdapter taskRecyclerViewAdapter;
|
||||||
private View view;
|
private View view;
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
@@ -65,10 +68,11 @@ public class TasksFragment extends Fragment implements
|
|||||||
public TasksFragment() {
|
public TasksFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TasksFragment newInstance(long taskListId, TaskChangedAdapter taskChangedAdapter) {
|
public static TasksFragment newInstance(long taskListId, boolean clearExpiredTasks, TaskChangedAdapter taskChangedAdapter) {
|
||||||
TasksFragment fragment = new TasksFragment();
|
TasksFragment fragment = new TasksFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong(TASK_LIST_ID, taskListId);
|
args.putLong(TASK_LIST_ID, taskListId);
|
||||||
|
args.putBoolean(CLEAR_EXPIRED_TASKS, clearExpiredTasks);
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.mAdapter = taskChangedAdapter;
|
fragment.mAdapter = taskChangedAdapter;
|
||||||
fragment.setRetainInstance(true);
|
fragment.setRetainInstance(true);
|
||||||
@@ -79,8 +83,10 @@ public class TasksFragment extends Fragment implements
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
mIsLargeLayout = getResources().getBoolean(R.bool.large_layout);
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
taskListId = getArguments().getLong(TASK_LIST_ID);
|
taskListId = getArguments().getLong(TASK_LIST_ID);
|
||||||
|
clearExpiredTasks = getArguments().getBoolean(CLEAR_EXPIRED_TASKS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,13 +96,21 @@ public class TasksFragment extends Fragment implements
|
|||||||
view = inflater.inflate(R.layout.fragment_tasks, container, false);
|
view = inflater.inflate(R.layout.fragment_tasks, container, false);
|
||||||
final Context context = view.getContext();
|
final Context context = view.getContext();
|
||||||
|
|
||||||
|
|
||||||
// Set the Recycler view
|
// Set the Recycler view
|
||||||
recyclerView = (RecyclerView) view.findViewById(R.id.task_list_view);
|
recyclerView = (RecyclerView) view.findViewById(R.id.task_list_view);
|
||||||
recyclerView.setLayoutManager(new NoScrollingLayoutManager(context));
|
recyclerView.setLayoutManager(new NoScrollingLayoutManager(context));
|
||||||
|
|
||||||
// Set RecyclerView Adapter
|
// Set RecyclerView Adapter
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
|
||||||
|
// Mark all tasks with an earlier do date as done
|
||||||
|
if (clearExpiredTasks) {
|
||||||
|
try (TaskDataAccess taskDataAccess = new TaskDataAccess(view.getContext(), TaskDataAccess.MODE.WRITE)) {
|
||||||
|
taskDataAccess.updateExpiredTasks(
|
||||||
|
Integer.valueOf(sharedPref.getString("pref_conf_today_action", "2")), taskListId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get all tasks
|
||||||
try (TaskDataAccess taskDataAccess = new TaskDataAccess(view.getContext())) {
|
try (TaskDataAccess taskDataAccess = new TaskDataAccess(view.getContext())) {
|
||||||
taskRecyclerViewAdapter = new TaskRecyclerViewAdapter(
|
taskRecyclerViewAdapter = new TaskRecyclerViewAdapter(
|
||||||
taskDataAccess.getAllTasks(taskListId),
|
taskDataAccess.getAllTasks(taskListId),
|
||||||
@@ -127,7 +141,21 @@ public class TasksFragment extends Fragment implements
|
|||||||
((MainActivity.SectionsPagerAdapter) viewPager.getAdapter()).getAllItems(), TasksFragment.this);
|
((MainActivity.SectionsPagerAdapter) viewPager.getAdapter()).getAllItems(), TasksFragment.this);
|
||||||
|
|
||||||
taskDialogFragment.setArguments(args);
|
taskDialogFragment.setArguments(args);
|
||||||
taskDialogFragment.show(manager, getResources().getString(R.string.action_edit_task));
|
|
||||||
|
// Open the fragment as a dialog or as full-screen depending on screen size
|
||||||
|
FragmentManager fragmentManager = getFragmentManager();
|
||||||
|
if (mIsLargeLayout)
|
||||||
|
taskDialogFragment.show(manager, getResources().getString(R.string.action_edit_task));
|
||||||
|
else {
|
||||||
|
// The device is smaller, so show the fragment fullscreen
|
||||||
|
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||||
|
// For a little polish, specify a transition animation
|
||||||
|
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||||
|
// To make it fullscreen, use the 'content' root view as the container
|
||||||
|
// for the fragment, which is always the root view for the activity
|
||||||
|
transaction.replace(android.R.id.content, taskDialogFragment)
|
||||||
|
.addToBackStack(null).commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -300,8 +328,7 @@ public class TasksFragment extends Fragment implements
|
|||||||
Spinner listSpinner = (Spinner) dialogView.findViewById(R.id.new_task_list);
|
Spinner listSpinner = (Spinner) dialogView.findViewById(R.id.new_task_list);
|
||||||
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);
|
||||||
RadioGroup priorityGroup = (RadioGroup) dialogView.findViewById(R.id.new_task_priority);
|
SeekBar seekBar = (SeekBar) dialogView.findViewById(R.id.new_task_priority);
|
||||||
RadioButton priorityRadio = (RadioButton) dialogView.findViewById(priorityGroup.getCheckedRadioButtonId());
|
|
||||||
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();
|
||||||
|
|
||||||
@@ -310,9 +337,9 @@ public class TasksFragment extends Fragment implements
|
|||||||
Task newTask = taskDataAccess.createOrUpdateTask(id,
|
Task newTask = taskDataAccess.createOrUpdateTask(id,
|
||||||
nameText.getText().toString(),
|
nameText.getText().toString(),
|
||||||
descText.getText().toString(),
|
descText.getText().toString(),
|
||||||
priorityRadio.getText().toString(),
|
seekBar.getProgress(),
|
||||||
taskList.getId(),
|
taskList.getId(),
|
||||||
new LocalDate(dueDatePicker.getYear(), dueDatePicker.getMonth(), dueDatePicker.getDayOfMonth()));
|
new LocalDate(dueDatePicker.getYear(), dueDatePicker.getMonth() + 1, dueDatePicker.getDayOfMonth()));
|
||||||
|
|
||||||
Bundle args = dialog.getArguments();
|
Bundle args = dialog.getArguments();
|
||||||
// Should never happen because we will have to be on this tab to open the dialog
|
// Should never happen because we will have to be on this tab to open the dialog
|
||||||
@@ -320,8 +347,15 @@ public class TasksFragment extends Fragment implements
|
|||||||
|
|
||||||
// Add the task
|
// Add the task
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
taskRecyclerViewAdapter.add(newTask, 0);
|
// If the new task is added to another task list, update the tab
|
||||||
recyclerView.scrollToPosition(0);
|
if (taskListId != taskList.getId()) {
|
||||||
|
mAdapter.onTaskListChanged(newTask, listSpinner.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
// Otherwise add it to the current one
|
||||||
|
else {
|
||||||
|
taskRecyclerViewAdapter.add(newTask, 0);
|
||||||
|
recyclerView.scrollToPosition(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update the task
|
// Update the task
|
||||||
else {
|
else {
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
<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>
|
@@ -35,7 +35,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="80dp"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<android.widget.ListView
|
<android.widget.ListView
|
||||||
android:id="@+id/tabs"
|
android:id="@+id/tabs"
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
android:id="@+id/left_arrow"
|
android:id="@+id/left_arrow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:contentDescription="@string/tab_left_arrow"
|
android:contentDescription="@string/tab_left_arrow"
|
||||||
@@ -39,7 +38,6 @@
|
|||||||
android:id="@+id/right_arrow"
|
android:id="@+id/right_arrow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:contentDescription="@string/tab_right_arrow"
|
android:contentDescription="@string/tab_right_arrow"
|
||||||
@@ -48,9 +46,7 @@
|
|||||||
android:id="@+id/tabs"
|
android:id="@+id/tabs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toRightOf="@+id/left_arrow"
|
|
||||||
android:layout_toEndOf="@+id/left_arrow"
|
android:layout_toEndOf="@+id/left_arrow"
|
||||||
android:layout_toLeftOf="@+id/right_arrow"
|
|
||||||
android:layout_toStartOf="@+id/right_arrow"
|
android:layout_toStartOf="@+id/right_arrow"
|
||||||
app:tabMode="scrollable" />
|
app:tabMode="scrollable" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
android:background="?android:attr/selectableItemBackground" >
|
android:background="?android:attr/selectableItemBackground" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_cycle"
|
android:id="@+id/task_cycle"
|
||||||
android:layout_width="56dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:textAppearance="?attr/textAppearanceListItem" />
|
android:textAppearance="?attr/textAppearanceListItem" />
|
||||||
@@ -17,6 +17,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/task_alarm"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:contentDescription="@string/task_alarm"/>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="?listPreferredItemHeight"
|
android:layout_height="?listPreferredItemHeight"
|
||||||
|
@@ -1,106 +1,102 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
<RelativeLayout
|
android:fitsSystemWindows="true">
|
||||||
android:layout_width="fill_parent"
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/text_margin"
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
android:orientation="vertical"
|
<android.support.v7.widget.Toolbar
|
||||||
tools:context=".activities.MainActivity">
|
android:id="@+id/new_task_toolbar"
|
||||||
<TextView
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/new_task_list_label"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_width="wrap_content"
|
android:background="?attr/colorPrimary"
|
||||||
android:layout_height="wrap_content"
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
android:text="@string/new_task_list"
|
</android.support.design.widget.AppBarLayout>
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
<Spinner
|
<ScrollView
|
||||||
android:id="@+id/new_task_list"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:layout_toEndOf="@id/new_task_list_label">
|
android:background="@android:color/background_light">
|
||||||
</Spinner>
|
<RelativeLayout
|
||||||
<TextView
|
|
||||||
android:id="@+id/new_task_name_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/new_task_name"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:layout_below="@id/new_task_list_label"/>
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/new_task_name"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/new_task_name_hint"
|
android:padding="@dimen/text_margin"
|
||||||
android:maxLines="1"
|
android:orientation="vertical"
|
||||||
android:inputType="text"
|
tools:context=".activities.MainActivity">
|
||||||
android:layout_below="@id/new_task_name_label"/>
|
<TextView
|
||||||
<TextView
|
android:id="@+id/new_task_list_label"
|
||||||
android:id="@+id/new_task_description_label"
|
android:text="@string/new_task_list"
|
||||||
android:layout_width="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="3dp"
|
||||||
android:text="@string/new_task_description"
|
android:layout_width="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_below="@id/new_task_name" />
|
<Spinner
|
||||||
<EditText
|
android:id="@+id/new_task_list"
|
||||||
android:id="@+id/new_task_description"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="5dp"
|
||||||
android:hint="@string/new_task_description_hint"
|
android:layout_toEndOf="@id/new_task_list_label">
|
||||||
android:gravity="top|start"
|
</Spinner>
|
||||||
android:lines="3"
|
<EditText
|
||||||
android:layout_below="@id/new_task_description_label" />
|
android:id="@+id/new_task_name"
|
||||||
<TextView
|
android:hint="@string/new_task_name_hint"
|
||||||
android:id="@+id/new_task_priority_label"
|
android:maxLines="1"
|
||||||
android:layout_width="match_parent"
|
android:inputType="text"
|
||||||
android:layout_height="wrap_content"
|
android:textSize="30sp"
|
||||||
android:text="@string/new_task_priority"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:layout_below="@id/new_task_description" />
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/new_task_priority"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/new_task_priority_label" >
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/new_task_priority_low"
|
|
||||||
android:text="@string/new_task_priority_low"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" >
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/new_task_priority_normal"
|
|
||||||
android:text="@string/new_task_priority_normal"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="true">
|
android:layout_below="@id/new_task_list"/>
|
||||||
</RadioButton>
|
<EditText
|
||||||
<RadioButton
|
android:id="@+id/new_task_description"
|
||||||
android:id="@+id/new_task_priority_high"
|
android:hint="@string/new_task_description_hint"
|
||||||
android:text="@string/new_task_priority_high"
|
android:gravity="top|start"
|
||||||
|
android:lines="3"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content"
|
||||||
</RadioButton>
|
android:layout_below="@id/new_task_name" />
|
||||||
</RadioGroup>
|
<TextView
|
||||||
<TextView
|
android:id="@+id/new_task_priority_label"
|
||||||
android:id="@+id/new_task_due_date_label"
|
android:text="@string/new_task_priority"
|
||||||
android:layout_width="200dp"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/new_task_due_date"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_toEndOf="@id/new_task_priority"
|
android:layout_below="@id/new_task_description" />
|
||||||
android:layout_below="@id/new_task_description" />
|
<SeekBar
|
||||||
<DatePicker
|
android:id="@+id/new_task_priority"
|
||||||
android:id="@+id/new_task_due_date"
|
android:max="2"
|
||||||
android:calendarViewShown="true"
|
android:progress="1"
|
||||||
android:spinnersShown="false"
|
android:layout_width="300dp"
|
||||||
android:layout_width="800dp"
|
android:layout_height="30dp"
|
||||||
android:layout_height="800dp"
|
android:layout_toEndOf="@id/new_task_priority_label"
|
||||||
android:layout_toEndOf="@id/new_task_priority"
|
android:layout_below="@id/new_task_description" />
|
||||||
android:layout_below="@id/new_task_due_date_label" />
|
<TextView
|
||||||
</RelativeLayout>
|
android:id="@+id/new_task_due_date_label"
|
||||||
</ScrollView>
|
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_priority" />
|
||||||
|
<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>
|
@@ -6,8 +6,9 @@
|
|||||||
android:background="?android:attr/selectableItemBackground" >
|
android:background="?android:attr/selectableItemBackground" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_cycle"
|
android:id="@+id/task_cycle"
|
||||||
android:layout_width="56dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:textAppearance="?attr/textAppearanceListItem" />
|
android:textAppearance="?attr/textAppearanceListItem" />
|
||||||
<TextView
|
<TextView
|
||||||
@@ -15,8 +16,17 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/task_alarm"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:contentDescription="@string/task_alarm"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_name"
|
android:id="@+id/task_name"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?attr/textAppearanceListItem"
|
android:textAppearance="?attr/textAppearanceListItem"
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
android:id="@+id/total_task_cycles"
|
android:id="@+id/total_task_cycles"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"/>
|
android:layout_alignParentStart="true"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/total_task_count"
|
android:id="@+id/total_task_count"
|
||||||
@@ -41,7 +40,6 @@
|
|||||||
android:id="@+id/task_background_done"
|
android:id="@+id/task_background_done"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:text="@string/task_confirmation_done_button"
|
android:text="@string/task_confirmation_done_button"
|
||||||
@@ -53,7 +51,6 @@
|
|||||||
android:id="@+id/task_background_next"
|
android:id="@+id/task_background_next"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:text="@string/task_confirmation_next_button"
|
android:text="@string/task_confirmation_next_button"
|
||||||
|
14
DoNExt/app/src/main/res/menu/menu_new_task.xml
Normal file
14
DoNExt/app/src/main/res/menu/menu_new_task.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_new_task_save"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/new_task_save"
|
||||||
|
app:showAsAction="always"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_new_task_delete"
|
||||||
|
android:orderInCategory="50"
|
||||||
|
android:title="@string/new_task_delete"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
</menu>
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">DoNext</string>
|
<string name="app_name">DoNext</string>
|
||||||
<string name="about_version_android">Version d\'Android: %s</string>
|
<string name="about_version_android">Version d\'Android: %d</string>
|
||||||
<string name="about_version_donext">Version de DoNext: %s</string>
|
<string name="about_version_donext">Version de DoNext: %s</string>
|
||||||
<string name="action_about">À propos</string>
|
<string name="action_about">À propos</string>
|
||||||
<string name="action_changeLayout">Changer l\'apparence</string>
|
<string name="action_changeLayout">Changer l\'apparence</string>
|
||||||
@@ -66,4 +66,5 @@
|
|||||||
<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="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="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="new_task_due_date">Date de fin</string>
|
||||||
|
<string name="task_alarm">Task is past due date</string>
|
||||||
</resources>
|
</resources>
|
4
DoNExt/app/src/main/res/values-large/bools.xml
Normal file
4
DoNExt/app/src/main/res/values-large/bools.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="large_layout">true</bool>
|
||||||
|
</resources>
|
4
DoNExt/app/src/main/res/values/bools.xml
Normal file
4
DoNExt/app/src/main/res/values/bools.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="large_layout">false</bool>
|
||||||
|
</resources>
|
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
<!-- Strings related to About -->
|
<!-- Strings related to About -->
|
||||||
<string name="about_version_donext">DoNext version %s</string>
|
<string name="about_version_donext">DoNext version %s</string>
|
||||||
<string name="about_version_android">Android version %s</string>
|
<string name="about_version_android">Android version %d</string>
|
||||||
<string name="about_link" translatable="false">https://github.com/wismna</string>
|
<string name="about_link" translatable="false">https://github.com/wismna</string>
|
||||||
<string name="settings_today_title">Today list</string>
|
<string name="settings_today_title">Today list</string>
|
||||||
<string name="settings_today_enable">Enable Today list?</string>
|
<string name="settings_today_enable">Enable Today list?</string>
|
||||||
@@ -84,4 +84,5 @@
|
|||||||
<string name="task_list_today_list_error">Name \"Today\" is reserved. You may activate the Today list from the Settings.</string>
|
<string name="task_list_today_list_error">Name \"Today\" is reserved. You may activate the Today list from the Settings.</string>
|
||||||
<string name="settings_today_action_title">Action at the end of the day</string>
|
<string name="settings_today_action_title">Action at the end of the day</string>
|
||||||
<string name="new_task_due_date">Due date</string>
|
<string name="new_task_due_date">Due date</string>
|
||||||
|
<string name="task_alarm">Task is past due date</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user