diff --git a/opentasks-theme/src/main/res/values-v23/theme_dark.xml b/opentasks-theme/src/main/res/values-v23/theme_dark.xml new file mode 100644 index 000000000..250ddbfde --- /dev/null +++ b/opentasks-theme/src/main/res/values-v23/theme_dark.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/opentasks-theme/src/main/res/values/attrs.xml b/opentasks-theme/src/main/res/values/attrs.xml index 986d64e26..731f5444c 100644 --- a/opentasks-theme/src/main/res/values/attrs.xml +++ b/opentasks-theme/src/main/res/values/attrs.xml @@ -14,4 +14,10 @@ + + + + \ No newline at end of file diff --git a/opentasks-theme/src/main/res/values/theme.xml b/opentasks-theme/src/main/res/values/theme.xml index 894ecc9cc..4717b55e5 100644 --- a/opentasks-theme/src/main/res/values/theme.xml +++ b/opentasks-theme/src/main/res/values/theme.xml @@ -5,10 +5,10 @@ + + + + + + + diff --git a/opentasks-theme/src/main/res/values/theme_light.xml b/opentasks-theme/src/main/res/values/theme_light.xml index 85182a236..beb395ea8 100644 --- a/opentasks-theme/src/main/res/values/theme_light.xml +++ b/opentasks-theme/src/main/res/values/theme_light.xml @@ -31,6 +31,8 @@ #d0000000 #80000000 #50000000 + #ffd0d0d0 + #fff0f0f0 #ffffffff #c0ffffff @@ -62,6 +64,8 @@ #d0000000 #80000000 #50000000 + #ffd0d0d0 + #fff0f0f0 #ffffffff #c0ffffff diff --git a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java index 2eb3cda7b..2ef044054 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java @@ -298,7 +298,7 @@ public void onScroll(int oldScrollY, int newScrollY) // ensure we're using the latest values mValues.update(mAppContext, CONTENT_VALUE_MAPPER); } - mListColor = TaskFieldAdapters.LIST_COLOR.get(mValues); + mListColor = TaskFieldAdapters.LIST_COLOR_DARKENED.get(mValues); // update the color of the action bar as soon as possible updateColor(0); setListUri(TaskLists.getContentUri(mAuthority), LIST_LOADER_VISIBLE_LISTS_FILTER); @@ -553,7 +553,7 @@ public void onContentLoaded(ContentSet contentSet) { if (contentSet.containsKey(Tasks.ACCOUNT_TYPE)) { - mListColor = TaskFieldAdapters.LIST_COLOR.get(contentSet); + mListColor = TaskFieldAdapters.LIST_COLOR_DARKENED.get(contentSet); updateColor((float) mRootView.getScrollY() / mTaskListBar.getMeasuredHeight()); if (mAppForEdit) @@ -596,7 +596,7 @@ public void onItemSelected(AdapterView arg0, View arg1, int pos, long itemId) Cursor c = (Cursor) arg0.getItemAtPosition(pos); String accountType = c.getString(TASK_LIST_PROJECTION_VALUES.account_type); - mListColor = TaskFieldAdapters.LIST_COLOR.get(c); + mListColor = TaskFieldAdapters.LIST_COLOR_DARKENED.get(c); updateColor((float) mRootView.getScrollY() / mTaskListBar.getMeasuredHeight()); if (mEditor != null) diff --git a/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java b/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java index b5c21bbac..0fe1bbab4 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java @@ -322,7 +322,7 @@ private void setListUri(Uri uri, String filter) public void onItemSelected(AdapterView parent, View view, int position, long id) { Cursor c = (Cursor) parent.getItemAtPosition(position); - mLastColor = TaskFieldAdapters.LIST_COLOR.get(c); + mLastColor = TaskFieldAdapters.LIST_COLOR_DARKENED.get(c); mColorBackground.setBackgroundColor(mLastColor); mSelectedListId = id; } diff --git a/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java b/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java index 9b936911d..6c8e2b200 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java @@ -498,7 +498,7 @@ private void selectChildView(ExpandableListView expandLV, int groupPosition, int } Uri taskUri = ContentUris.withAppendedId(Instances.getContentUri(mAuthority), (long) TaskFieldAdapters.TASK_ID.get(cursor)); - Color taskListColor = new ValueColor(TaskFieldAdapters.LIST_COLOR.get(cursor)); + Color taskListColor = new ValueColor(TaskFieldAdapters.LIST_COLOR_DARKENED.get(cursor)); mCallbacks.onItemSelected(taskUri, taskListColor, force, mInstancePosition); } } diff --git a/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java b/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java index 8b3539c79..cd439271a 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java @@ -658,7 +658,7 @@ public void onContentLoaded(ContentSet contentSet) { if (contentSet.containsKey(Tasks.ACCOUNT_TYPE)) { - mListColor = TaskFieldAdapters.LIST_COLOR.get(contentSet); + mListColor = TaskFieldAdapters.LIST_COLOR_DARKENED.get(contentSet); ((Callback) getActivity()).onListColorLoaded(new ValueColor(mListColor)); updateColor(); diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/BaseTaskViewDescriptor.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/BaseTaskViewDescriptor.java index c8adefc0e..1a5ff2365 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/BaseTaskViewDescriptor.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/BaseTaskViewDescriptor.java @@ -270,12 +270,11 @@ protected void setColorBar(View view, Cursor cursor) if (STATUS.get(cursor) == STATUS_CANCELLED) { - cardView.setCardBackgroundColor(0xfff0f0f0); + cardView.setCardBackgroundColor(new AttributeColor(view.getContext(), R.attr.cancelledCardBackground).argb()); + cardView.setStrokeWidth(0); cardView.setStrokeColor(0); - ((TextView) cardView.findViewById(android.R.id.title)).setTextColor( - new AttributeColor(view.getContext(), android.R.attr.textColorTertiary).argb()); - cardView.setStrokeWidth(view.getResources().getDimensionPixelSize(R.dimen.opentasks_cardlist_open_border_width)); - + ((TextView) cardView.findViewById(android.R.id.title)) + .setTextColor(new AttributeColor(view.getContext(), android.R.attr.textColorTertiary).argb()); } else { @@ -283,7 +282,8 @@ protected void setColorBar(View view, Cursor cursor) //cardView.setCardElevation(1f); ((TextView) cardView.findViewById(android.R.id.title)).setTextColor( new AttributeColor(view.getContext(), android.R.attr.textColorTertiary).argb()); - cardView.setStrokeColor(0xfff0f0f0); + // todo: use a dedicated color + cardView.setStrokeColor(new AttributeColor(view.getContext(), R.attr.flatCardBorderColor).argb()); cardView.setStrokeWidth(view.getResources().getDimensionPixelSize(R.dimen.opentasks_cardlist_closed_border_width)); } cardView.setCardElevation(view.getResources().getDimensionPixelSize(R.dimen.opentasks_cardlist_closed_elevation)); diff --git a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java index 0e90d7c0e..b37e8bf01 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java +++ b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java @@ -363,7 +363,7 @@ public static TaskListWidgetItem[] getWidgetItems(Cursor mTasksCursor) while (mTasksCursor.moveToNext()) { items[itemIndex] = new TaskListWidgetItem(TaskFieldAdapters.TASK_ID.get(mTasksCursor), TaskFieldAdapters.TITLE.get(mTasksCursor), - TaskFieldAdapters.DUE.get(mTasksCursor), TaskFieldAdapters.LIST_COLOR.get(mTasksCursor), + TaskFieldAdapters.DUE.get(mTasksCursor), TaskFieldAdapters.LIST_COLOR_DARKENED.get(mTasksCursor), TaskFieldAdapters.IS_CLOSED.get(mTasksCursor)); itemIndex++; } diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java b/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java index 23cccf4e3..2d128249e 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java @@ -77,7 +77,7 @@ public void inflate() * Add a couple of fields to the model. */ // task list color - addField(new FieldDescriptor(context, R.id.task_field_list_color, R.string.task_list, null, TaskFieldAdapters.LIST_COLOR) + addField(new FieldDescriptor(context, R.id.task_field_list_color, R.string.task_list, null, TaskFieldAdapters.LIST_COLOR_DARKENED) .setViewLayout(LIST_COLOR_VIEW).setEditorLayout(LIST_COLOR_VIEW).setNoAutoAdd(true)); // task list name diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java b/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java index 48886b1ec..e516e687d 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java @@ -153,7 +153,7 @@ public final class TaskFieldAdapters /** * Adapter for the Color of the task. */ - public final static IntegerFieldAdapter LIST_COLOR = new ColorFieldAdapter(TaskContract.Tasks.LIST_COLOR, 0.8f); + public final static IntegerFieldAdapter LIST_COLOR_DARKENED = new ColorFieldAdapter(TaskContract.Tasks.LIST_COLOR, 0.8f); /** * Adapter for the Raw Color Value of the task. diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java b/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java index 152814ffc..55e28a203 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java @@ -289,7 +289,7 @@ public void inflate() throws ModelInflaterException try { // add a field for the list - addField(new FieldDescriptor(context, R.id.task_field_list_color, R.string.task_list, null, TaskFieldAdapters.LIST_COLOR) + addField(new FieldDescriptor(context, R.id.task_field_list_color, R.string.task_list, null, TaskFieldAdapters.LIST_COLOR_DARKENED) .setViewLayout(DefaultModel.LIST_COLOR_VIEW).setEditorLayout(DefaultModel.LIST_COLOR_VIEW).setNoAutoAdd(true)); addField(new FieldDescriptor(context, R.id.task_field_list_name, R.string.task_list, null, new StringFieldAdapter(Tasks.LIST_NAME)).setViewLayout( new LayoutDescriptor(R.layout.text_field_view_nodivider_large).setOption(LayoutDescriptor.OPTION_NO_TITLE, true)).setNoAutoAdd(true)); diff --git a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java index da64335f7..ee781137d 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java +++ b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java @@ -136,7 +136,7 @@ public View getDropDownView(int position, View convertView, ViewGroup parent) TextView accountName = (TextView) convertView.findViewById(R.id.task_list_account_name); Cursor cursor = (Cursor) getItem(position); - listColor.setBackgroundColor(TaskFieldAdapters.LIST_COLOR.get(cursor)); + listColor.setBackgroundColor(TaskFieldAdapters.LIST_COLOR_DARKENED.get(cursor)); listName.setText(cursor.getString(mTaskNameColumn)); accountName.setText(cursor.getString(mAccountNameColumn)); return convertView; diff --git a/opentasks/src/main/res/layout/fragment_quick_add_dialog.xml b/opentasks/src/main/res/layout/fragment_quick_add_dialog.xml index 5113fb30f..bac24afe9 100644 --- a/opentasks/src/main/res/layout/fragment_quick_add_dialog.xml +++ b/opentasks/src/main/res/layout/fragment_quick_add_dialog.xml @@ -5,7 +5,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" - android:background="@android:color/white" + android:background="?android:attr/windowBackground" android:orientation="vertical" android:padding="0dp"> @@ -75,6 +75,7 @@ android:text="@string/quick_add_task_created" android:textAppearance="?android:attr/textAppearanceLarge" android:visibility="invisible" + app:drawableTint="?android:attr/textColorPrimary" app:drawableStartCompat="@drawable/ic_checkmark_light" /> diff --git a/opentasks/src/main/res/values/styles.xml b/opentasks/src/main/res/values/styles.xml index 742843f97..d76ef34d9 100644 --- a/opentasks/src/main/res/values/styles.xml +++ b/opentasks/src/main/res/values/styles.xml @@ -328,7 +328,7 @@