mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Reset task rendering when clicked no on confirmation
Add description to task list Change task title look depending on priority
This commit is contained in:
@@ -231,6 +231,15 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
PerformSwipe(taskDataAccess, taskAdapter, itemPosition, direction);
|
PerformSwipe(taskDataAccess, taskAdapter, itemPosition, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDialogNegativeClick(android.support.v4.app.DialogFragment dialog) {
|
||||||
|
Bundle args = dialog.getArguments();
|
||||||
|
int itemPosition = args.getInt("ItemPosition");
|
||||||
|
|
||||||
|
TaskAdapter taskAdapter = ((ConfirmDialogFragment)dialog).getTaskAdapter();
|
||||||
|
taskAdapter.notifyItemChanged(itemPosition);
|
||||||
|
}
|
||||||
|
|
||||||
private void OpenNewTaskDialog() {
|
private void OpenNewTaskDialog() {
|
||||||
android.app.FragmentManager manager = getFragmentManager();
|
android.app.FragmentManager manager = getFragmentManager();
|
||||||
NewTaskFragment newTaskFragment = new NewTaskFragment();
|
NewTaskFragment newTaskFragment = new NewTaskFragment();
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package com.wismna.geoffroy.donext.adapters;
|
package com.wismna.geoffroy.donext.adapters;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -41,6 +43,18 @@ public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.ViewHolder> {
|
|||||||
holder.mIdView.setText(String.valueOf(holder.mItem.getId()));
|
holder.mIdView.setText(String.valueOf(holder.mItem.getId()));
|
||||||
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());
|
||||||
|
holder.mDescriptionView.setText(holder.mItem.getDescription());
|
||||||
|
int priority = holder.mItem.getPriority();
|
||||||
|
|
||||||
|
switch (priority)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
holder.mTitleView.setTextColor(Color.LTGRAY);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
holder.mTitleView.setTypeface(holder.mTitleView.getTypeface(), Typeface.BOLD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -90,6 +104,7 @@ public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.ViewHolder> {
|
|||||||
public final TextView mIdView;
|
public final TextView mIdView;
|
||||||
public final TextView mCycleView;
|
public final TextView mCycleView;
|
||||||
public final TextView mTitleView;
|
public final TextView mTitleView;
|
||||||
|
public final TextView mDescriptionView;
|
||||||
public Task mItem;
|
public Task mItem;
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
public ViewHolder(View view) {
|
||||||
@@ -99,6 +114,7 @@ public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.ViewHolder> {
|
|||||||
mIdView = (TextView) view.findViewById(R.id.task_id);
|
mIdView = (TextView) view.findViewById(R.id.task_id);
|
||||||
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);
|
||||||
|
mDescriptionView = (TextView) view.findViewById(R.id.task_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -14,6 +14,7 @@ public class ConfirmDialogFragment extends DialogFragment {
|
|||||||
public interface ConfirmDialogListener {
|
public interface ConfirmDialogListener {
|
||||||
void onDialogPositiveClick(DialogFragment dialog);
|
void onDialogPositiveClick(DialogFragment dialog);
|
||||||
void onDialogNeutralClick(DialogFragment dialog);
|
void onDialogNeutralClick(DialogFragment dialog);
|
||||||
|
void onDialogNegativeClick(DialogFragment dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfirmDialogListener confirmDialogListener;
|
private ConfirmDialogListener confirmDialogListener;
|
||||||
@@ -63,6 +64,7 @@ public class ConfirmDialogFragment extends DialogFragment {
|
|||||||
.setNegativeButton(R.string.task_swipe_confirmation_no, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.task_swipe_confirmation_no, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
// User cancelled the dialog
|
// User cancelled the dialog
|
||||||
|
confirmDialogListener.onDialogNegativeClick(ConfirmDialogFragment.this);
|
||||||
}
|
}
|
||||||
}).setNeutralButton(R.string.task_swipe_confirmation_never, new DialogInterface.OnClickListener() {
|
}).setNeutralButton(R.string.task_swipe_confirmation_never, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
@@ -1,29 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?listPreferredItemHeight"
|
android:layout_height="70dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:foreground="?selectableItemBackground" >
|
android:foreground="?selectableItemBackground" >
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/task_cycle"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:textAppearance="?attr/textAppearanceListItem" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_id"
|
android:id="@+id/task_id"
|
||||||
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" />
|
||||||
<TextView
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/task_cycle"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?listPreferredItemHeight"
|
||||||
android:layout_margin="@dimen/text_margin"
|
android:orientation="vertical">
|
||||||
android:textAppearance="?attr/textAppearanceListItem" />
|
<TextView
|
||||||
<TextView
|
android:id="@+id/task_name"
|
||||||
android:id="@+id/task_name"
|
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:layout_margin="@dimen/text_margin"
|
<TextView
|
||||||
android:textAppearance="?attr/textAppearanceListItem" />
|
android:id="@+id/task_description"
|
||||||
<!--<Button
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:maxLines="2"
|
||||||
android:text="@string/task_list_delete"
|
android:textColor="@color/colorPrimary"
|
||||||
android:onClick="onDeleteTask"/>-->
|
android:textSize="14dp"
|
||||||
|
android:textAppearance="?attr/textAppearanceListItemSmall" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -2,12 +2,12 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context=".activities.MainActivity">
|
tools:context=".activities.MainActivity">
|
||||||
<item
|
<!--<item
|
||||||
android:id="@+id/action_newTask"
|
android:id="@+id/action_newTask"
|
||||||
android:orderInCategory="10"
|
android:orderInCategory="10"
|
||||||
android:title="@string/action_new_task"
|
android:title="@string/action_new_task"
|
||||||
android:onClick="openNewTaskDialog"
|
android:onClick="openNewTaskDialog"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_editTabs"
|
android:id="@+id/action_editTabs"
|
||||||
android:orderInCategory="20"
|
android:orderInCategory="20"
|
||||||
|
Reference in New Issue
Block a user