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);
|
||||
}
|
||||
|
||||
@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() {
|
||||
android.app.FragmentManager manager = getFragmentManager();
|
||||
NewTaskFragment newTaskFragment = new NewTaskFragment();
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.wismna.geoffroy.donext.adapters;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
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.mCycleView.setText(String.valueOf(holder.mItem.getCycle()));
|
||||
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() {
|
||||
@Override
|
||||
@@ -90,6 +104,7 @@ public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.ViewHolder> {
|
||||
public final TextView mIdView;
|
||||
public final TextView mCycleView;
|
||||
public final TextView mTitleView;
|
||||
public final TextView mDescriptionView;
|
||||
public Task mItem;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
@@ -99,6 +114,7 @@ public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.ViewHolder> {
|
||||
mIdView = (TextView) view.findViewById(R.id.task_id);
|
||||
mCycleView = (TextView) view.findViewById(R.id.task_cycle);
|
||||
mTitleView = (TextView) view.findViewById(R.id.task_name);
|
||||
mDescriptionView = (TextView) view.findViewById(R.id.task_description);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -14,6 +14,7 @@ public class ConfirmDialogFragment extends DialogFragment {
|
||||
public interface ConfirmDialogListener {
|
||||
void onDialogPositiveClick(DialogFragment dialog);
|
||||
void onDialogNeutralClick(DialogFragment dialog);
|
||||
void onDialogNegativeClick(DialogFragment dialog);
|
||||
}
|
||||
|
||||
private ConfirmDialogListener confirmDialogListener;
|
||||
@@ -63,6 +64,7 @@ public class ConfirmDialogFragment extends DialogFragment {
|
||||
.setNegativeButton(R.string.task_swipe_confirmation_no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// User cancelled the dialog
|
||||
confirmDialogListener.onDialogNegativeClick(ConfirmDialogFragment.this);
|
||||
}
|
||||
}).setNeutralButton(R.string.task_swipe_confirmation_never, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
@@ -1,29 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?listPreferredItemHeight"
|
||||
android:layout_height="70dp"
|
||||
android:orientation="horizontal"
|
||||
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
|
||||
android:id="@+id/task_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/task_cycle"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem" />
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem" />
|
||||
<!--<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/task_list_delete"
|
||||
android:onClick="onDeleteTask"/>-->
|
||||
android:layout_height="?listPreferredItemHeight"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceListItem" />
|
||||
<TextView
|
||||
android:id="@+id/task_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14dp"
|
||||
android:textAppearance="?attr/textAppearanceListItemSmall" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@@ -2,12 +2,12 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activities.MainActivity">
|
||||
<item
|
||||
<!--<item
|
||||
android:id="@+id/action_newTask"
|
||||
android:orderInCategory="10"
|
||||
android:title="@string/action_new_task"
|
||||
android:onClick="openNewTaskDialog"
|
||||
app:showAsAction="never" />
|
||||
app:showAsAction="never" />-->
|
||||
<item
|
||||
android:id="@+id/action_editTabs"
|
||||
android:orderInCategory="20"
|
||||
|
Reference in New Issue
Block a user