mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Add task list name in Today select tasks dialog (but Today is broken and it shows empty task lists)
This commit is contained in:
Binary file not shown.
@@ -140,6 +140,7 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
||||
|
||||
// Handles today list
|
||||
MenuItem todayListItem = menu.findItem(R.id.action_todayList);
|
||||
if (todayListItem == null) return false;
|
||||
todayListItem.setVisible(sharedPref.getBoolean("pref_conf_today_enable", false));
|
||||
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
|
@@ -66,7 +66,7 @@ public class TodayActivity extends AppCompatActivity
|
||||
|
||||
public void onNewTaskClick(View view) {
|
||||
TodayFormDialogFragment taskDialogFragment =
|
||||
TodayFormDialogFragment.newInstance(this, TodayActivity.this);
|
||||
TodayFormDialogFragment.newInstance(TodayActivity.this);
|
||||
|
||||
// Set some configuration values for the dialog
|
||||
Bundle args = new Bundle();
|
||||
|
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.wismna.geoffroy.donext.R;
|
||||
@@ -34,15 +35,18 @@ public class TodayArrayAdapter extends ArrayAdapter<Task> {
|
||||
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_task_item, parent, false);
|
||||
}
|
||||
TextView titleView = (TextView) convertView.findViewById(R.id.task_list_item_title);
|
||||
TextView taskView = (TextView) convertView.findViewById(R.id.task_list_item_tasklist);
|
||||
LinearLayout layoutView = (LinearLayout) convertView.findViewById(R.id.task_list_item_layout);
|
||||
Task item = this.getItem(position);
|
||||
if (item != null) {
|
||||
titleView.setText(item.getName());
|
||||
taskView.setText(item.getTaskListName());
|
||||
if (item.isToday()) {
|
||||
titleView.setTypeface(titleView.getTypeface(), Typeface.BOLD);
|
||||
titleView.setBackgroundColor(Color.parseColor("#B2DFDB"));
|
||||
layoutView.setBackgroundColor(Color.parseColor("#B2DFDB"));
|
||||
} else {
|
||||
titleView.setTypeface(Typeface.DEFAULT);
|
||||
titleView.setBackgroundColor(Color.WHITE);
|
||||
layoutView.setBackgroundColor(Color.WHITE);
|
||||
}
|
||||
}
|
||||
return convertView;
|
||||
|
@@ -87,6 +87,7 @@ public class Task {
|
||||
return taskListName;
|
||||
}
|
||||
|
||||
// TODO: implement this via SQL
|
||||
public void setTaskListName(String taskListName) {
|
||||
this.taskListName = taskListName;
|
||||
}
|
||||
|
@@ -83,12 +83,38 @@ public class TaskDataAccess implements AutoCloseable {
|
||||
}
|
||||
|
||||
public List<Task> getAllTasks() {
|
||||
Cursor cursor = database.query(DatabaseHelper.TASKS_TABLE_NAME, taskColumns,
|
||||
/*Cursor cursor = database.query(DatabaseHelper.TASKS_TABLE_NAME, taskColumns,
|
||||
DatabaseHelper.TASKS_COLUMN_DONE + " = " + 0 +
|
||||
" AND " + DatabaseHelper.TASKS_COLUMN_DELETED + " = " + 0,
|
||||
null, null, null,
|
||||
DatabaseHelper.TASKS_COLUMN_CYCLE + ", " + DatabaseHelper.COLUMN_ID + " DESC");
|
||||
return getTasksFromCursor(cursor);
|
||||
DatabaseHelper.TASKS_COLUMN_CYCLE + ", " + DatabaseHelper.COLUMN_ID + " DESC");*/
|
||||
Cursor cursor = database.rawQuery("SELECT " +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.COLUMN_ID + "," +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_NAME + "," +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_TODAYDATE + "," +
|
||||
DatabaseHelper.TASKLIST_TABLE_NAME + "." + DatabaseHelper.TASKLIST_COLUMN_NAME + " AS tasklistname " +
|
||||
" FROM " + DatabaseHelper.TASKLIST_TABLE_NAME +
|
||||
" LEFT JOIN " + DatabaseHelper.TASKS_TABLE_NAME +
|
||||
" ON " + DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_LIST +
|
||||
" = " + DatabaseHelper.TASKLIST_TABLE_NAME + "." + DatabaseHelper.COLUMN_ID
|
||||
, null);
|
||||
List<Task> tasks = new ArrayList<>();
|
||||
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
Task task = new Task();
|
||||
task.setId(cursor.getLong(0));
|
||||
task.setName(cursor.getString(1));
|
||||
task.setTodayDate(cursor.getString(2));
|
||||
task.setTaskListName(cursor.getString(3));
|
||||
tasks.add(task);
|
||||
cursor.moveToNext();
|
||||
}
|
||||
// make sure to close the cursor
|
||||
cursor.close();
|
||||
|
||||
return tasks;
|
||||
//return getTasksFromCursor(cursor);
|
||||
}
|
||||
|
||||
public List<Task> getAllTasksFromList(long id) {
|
||||
|
@@ -37,7 +37,7 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
|
||||
private TodayFormDialogFragment.TodayTaskListener mListener;
|
||||
private final List<Task> mUpdatedTasks = new ArrayList<>();
|
||||
|
||||
public static TodayFormDialogFragment newInstance(Context context, TodayTaskListener todayTaskListener) {
|
||||
public static TodayFormDialogFragment newInstance(TodayTaskListener todayTaskListener) {
|
||||
TodayFormDialogFragment fragment = new TodayFormDialogFragment();
|
||||
|
||||
fragment.mListener = todayTaskListener;
|
||||
|
@@ -1,8 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/task_list_item_title"
|
||||
android:id="@+id/task_list_item_layout"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="20dp"
|
||||
android:textSize="20sp" />
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/task_list_item_tasklist"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp" />
|
||||
<TextView
|
||||
android:id="@+id/task_list_item_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="4dp"/>
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user