From fbedfc3c8930b457e4313470da6cda0298304ee3 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sat, 27 Jul 2019 00:44:20 -0500 Subject: [PATCH] More theme adjustments --- app/build.gradle.kts | 2 +- .../todoroo/astrid/core/OldTaskPreferences.java | 15 ++++++++++----- .../astrid/gcal/CalendarReminderActivity.java | 3 ++- .../org/tasks/billing/NameYourPriceDialog.java | 4 +++- .../java/org/tasks/billing/PurchaseAdapter.java | 13 ++++++++----- .../caldav/CaldavAccountSettingsActivity.java | 3 ++- .../tasks/sync/SynchronizationPreferences.java | 3 ++- .../main/java/org/tasks/tasklist/ViewHolder.java | 8 ++------ .../org/tasks/tasklist/ViewHolderFactory.java | 3 --- .../res/layout-v21/task_adapter_row_simple.xml | 1 + app/src/main/res/layout/aac_record_activity.xml | 1 - .../main/res/layout/activity_location_picker.xml | 3 +-- app/src/main/res/layout/comment_adapter_row.xml | 1 - app/src/main/res/layout/filter_adapter_row.xml | 1 - app/src/main/res/layout/row_attribution.xml | 1 - app/src/main/res/layout/row_place.xml | 1 - app/src/main/res/values/theme.xml | 10 ++-------- 17 files changed, 34 insertions(+), 39 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ceae41c89..4cbf84ac0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,7 +25,7 @@ android { defaultConfig { testApplicationId = "org.tasks.test" applicationId = "org.tasks" - versionCode = 602 + versionCode = 603 versionName = "6.8" targetSdkVersion(Versions.compileSdk) minSdkVersion(Versions.minSdk) diff --git a/app/src/main/java/com/todoroo/astrid/core/OldTaskPreferences.java b/app/src/main/java/com/todoroo/astrid/core/OldTaskPreferences.java index 000fc9e31..44d38f018 100644 --- a/app/src/main/java/com/todoroo/astrid/core/OldTaskPreferences.java +++ b/app/src/main/java/com/todoroo/astrid/core/OldTaskPreferences.java @@ -81,7 +81,8 @@ public class OldTaskPreferences extends InjectingPreferenceActivity { private void purgeDeletedTasks() { dialogBuilder - .newDialog(R.string.EPr_manage_purge_deleted_message) + .newDialog() + .setMessage(R.string.EPr_manage_purge_deleted_message) .setPositiveButton( android.R.string.ok, (dialog, which) -> @@ -93,7 +94,8 @@ public class OldTaskPreferences extends InjectingPreferenceActivity { private void deleteCompletedEvents() { dialogBuilder - .newDialog(R.string.EPr_manage_delete_completed_gcal_message) + .newDialog() + .setMessage(R.string.EPr_manage_delete_completed_gcal_message) .setPositiveButton( android.R.string.ok, (dialog, which) -> @@ -109,7 +111,8 @@ public class OldTaskPreferences extends InjectingPreferenceActivity { private void deleteAllCalendarEvents() { dialogBuilder - .newDialog(R.string.EPr_manage_delete_all_gcal_message) + .newDialog() + .setMessage(R.string.EPr_manage_delete_all_gcal_message) .setPositiveButton( android.R.string.ok, (dialog, which) -> @@ -133,7 +136,8 @@ public class OldTaskPreferences extends InjectingPreferenceActivity { private void resetPreferences() { dialogBuilder - .newDialog(R.string.EPr_reset_preferences_warning) + .newDialog() + .setMessage(R.string.EPr_reset_preferences_warning) .setPositiveButton( R.string.EPr_reset_preferences, (dialog, which) -> { @@ -146,7 +150,8 @@ public class OldTaskPreferences extends InjectingPreferenceActivity { private void deleteTaskData() { dialogBuilder - .newDialog(R.string.EPr_delete_task_data_warning) + .newDialog() + .setMessage(R.string.EPr_delete_task_data_warning) .setPositiveButton( R.string.EPr_delete_task_data, (dialog, which) -> { diff --git a/app/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java b/app/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java index 69d337152..9f3346a88 100644 --- a/app/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java +++ b/app/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java @@ -44,7 +44,8 @@ public class CalendarReminderActivity extends ThemedInjectingAppCompatActivity { ignorePresses++; if (ignorePresses == IGNORE_PROMPT_COUNT) { dialogBuilder - .newDialog(R.string.CRA_ignore_body) + .newDialog() + .setMessage(R.string.CRA_ignore_body) .setPositiveButton( R.string.CRA_ignore_all, (dialog, which) -> { diff --git a/app/src/main/java/org/tasks/billing/NameYourPriceDialog.java b/app/src/main/java/org/tasks/billing/NameYourPriceDialog.java index deda828ba..e4847fa76 100644 --- a/app/src/main/java/org/tasks/billing/NameYourPriceDialog.java +++ b/app/src/main/java/org/tasks/billing/NameYourPriceDialog.java @@ -34,6 +34,7 @@ import org.tasks.injection.DialogFragmentComponent; import org.tasks.injection.ForActivity; import org.tasks.injection.InjectingDialogFragment; import org.tasks.locale.Locale; +import org.tasks.themes.Theme; public class NameYourPriceDialog extends InjectingDialogFragment implements OnPurchasesUpdated { @@ -46,6 +47,7 @@ public class NameYourPriceDialog extends InjectingDialogFragment implements OnPu @Inject LocalBroadcastManager localBroadcastManager; @Inject Inventory inventory; @Inject Locale locale; + @Inject Theme theme; @BindView(R.id.recycler_view) RecyclerView recyclerView; @@ -90,7 +92,7 @@ public class NameYourPriceDialog extends InjectingDialogFragment implements OnPu setWaitScreen(true); - adapter = new PurchaseAdapter((Activity) context, locale, this::onPriceChanged); + adapter = new PurchaseAdapter(context, theme, locale, this::onPriceChanged); buttons.addOnButtonCheckedListener(this::onButtonChecked); diff --git a/app/src/main/java/org/tasks/billing/PurchaseAdapter.java b/app/src/main/java/org/tasks/billing/PurchaseAdapter.java index 2ef944bac..d421b3ddb 100644 --- a/app/src/main/java/org/tasks/billing/PurchaseAdapter.java +++ b/app/src/main/java/org/tasks/billing/PurchaseAdapter.java @@ -1,6 +1,6 @@ package org.tasks.billing; -import android.app.Activity; +import android.content.Context; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -9,17 +9,20 @@ import androidx.recyclerview.widget.ListAdapter; import org.tasks.Callback; import org.tasks.R; import org.tasks.locale.Locale; +import org.tasks.themes.Theme; public class PurchaseAdapter extends ListAdapter { - private final Activity activity; + private final Context context; + private final Theme theme; private final Locale locale; private final Callback onPriceChanged; private int selected; - PurchaseAdapter(Activity activity, Locale locale, Callback onPriceChanged) { + PurchaseAdapter(Context context, Theme theme, Locale locale, Callback onPriceChanged) { super(new DiffCallback()); - this.activity = activity; + this.context = context; + this.theme = theme; this.locale = locale; this.onPriceChanged = onPriceChanged; } @@ -38,7 +41,7 @@ public class PurchaseAdapter extends ListAdapter { @NonNull @Override public PurchaseHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = activity.getLayoutInflater().inflate(R.layout.dialog_purchase_cell, parent, false); + View view = theme.getLayoutInflater(context).inflate(R.layout.dialog_purchase_cell, parent, false); return new PurchaseHolder(view, onPriceChanged, locale); } diff --git a/app/src/main/java/org/tasks/caldav/CaldavAccountSettingsActivity.java b/app/src/main/java/org/tasks/caldav/CaldavAccountSettingsActivity.java index ed15b7d5e..f5436a8be 100644 --- a/app/src/main/java/org/tasks/caldav/CaldavAccountSettingsActivity.java +++ b/app/src/main/java/org/tasks/caldav/CaldavAccountSettingsActivity.java @@ -409,7 +409,8 @@ public class CaldavAccountSettingsActivity extends ThemedInjectingAppCompatActiv } dialogBuilder - .newDialog(R.string.logout_warning, caldavAccount.getName()) + .newDialog() + .setMessage(R.string.logout_warning, caldavAccount.getName()) .setPositiveButton( R.string.remove, (dialog, which) -> { diff --git a/app/src/main/java/org/tasks/sync/SynchronizationPreferences.java b/app/src/main/java/org/tasks/sync/SynchronizationPreferences.java index 7b0b6cb2c..632fc8fa0 100644 --- a/app/src/main/java/org/tasks/sync/SynchronizationPreferences.java +++ b/app/src/main/java/org/tasks/sync/SynchronizationPreferences.java @@ -136,7 +136,8 @@ public class SynchronizationPreferences extends InjectingPreferenceActivity { String name = account.getAccount(); AlertDialog alertDialog = dialogBuilder - .newDialog(R.string.logout_warning, name) + .newDialog() + .setMessage(R.string.logout_warning, name) .setPositiveButton( R.string.logout, (dialog, which) -> { diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java index 22e639124..36b5da49b 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java @@ -43,7 +43,6 @@ public class ViewHolder extends RecyclerView.ViewHolder { private final Activity context; private final Preferences preferences; private final int textColorSecondary; - private final int textColorPrimary; private final TaskDao taskDao; private final ViewHolderCallbacks callback; private final DisplayMetrics metrics; @@ -98,7 +97,6 @@ public class ViewHolder extends RecyclerView.ViewHolder { ChipProvider chipProvider, int textColorOverdue, int textColorSecondary, - int textColorPrimary, TaskDao taskDao, ViewHolderCallbacks callback, DisplayMetrics metrics, @@ -112,7 +110,6 @@ public class ViewHolder extends RecyclerView.ViewHolder { this.chipProvider = chipProvider; this.textColorOverdue = textColorOverdue; this.textColorSecondary = textColorSecondary; - this.textColorPrimary = textColorPrimary; this.taskDao = taskDao; this.callback = callback; this.metrics = metrics; @@ -231,11 +228,10 @@ public class ViewHolder extends RecyclerView.ViewHolder { private void setupTitleAndCheckbox() { if (task.isCompleted()) { - nameView.setTextColor(textColorSecondary); + nameView.setEnabled(false); nameView.setPaintFlags(nameView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { - nameView.setTextColor(task.isHidden() ? textColorSecondary : textColorPrimary); - nameView.setEnabled(true); + nameView.setEnabled(!task.isHidden()); nameView.setPaintFlags(nameView.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java index dd27bf0f8..ee57a3881 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java @@ -21,7 +21,6 @@ import org.tasks.ui.ChipProvider; public class ViewHolderFactory { - private final int textColorPrimary; private final int textColorSecondary; private final int textColorOverdue; private final Context context; @@ -50,7 +49,6 @@ public class ViewHolderFactory { this.taskDao = taskDao; this.preferences = preferences; this.linkify = linkify; - textColorPrimary = getColor(context, R.color.text_primary); textColorSecondary = getData(context, android.R.attr.textColorSecondary); textColorOverdue = getColor(context, R.color.overdue); background = getResourceId(context, R.attr.selectableItemBackground); @@ -71,7 +69,6 @@ public class ViewHolderFactory { chipProvider, textColorOverdue, textColorSecondary, - textColorPrimary, taskDao, callbacks, metrics, diff --git a/app/src/main/res/layout-v21/task_adapter_row_simple.xml b/app/src/main/res/layout-v21/task_adapter_row_simple.xml index 9d3e386b4..10de9600c 100644 --- a/app/src/main/res/layout-v21/task_adapter_row_simple.xml +++ b/app/src/main/res/layout-v21/task_adapter_row_simple.xml @@ -9,6 +9,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="1px" + app:cardBackgroundColor="?android:colorBackground" app:cardCornerRadius="0dp" app:cardElevation="?attr/card_elevation" app:cardPreventCornerOverlap="false"> diff --git a/app/src/main/res/layout/aac_record_activity.xml b/app/src/main/res/layout/aac_record_activity.xml index 33d41cdf3..4e18a79ce 100644 --- a/app/src/main/res/layout/aac_record_activity.xml +++ b/app/src/main/res/layout/aac_record_activity.xml @@ -17,7 +17,6 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dip" android:gravity="center" - android:textColor="@color/text_primary" android:textSize="24sp"/> + android:textAppearance="@style/TextAppearance"/> diff --git a/app/src/main/res/layout/comment_adapter_row.xml b/app/src/main/res/layout/comment_adapter_row.xml index 1e5583d3c..553fda5dc 100644 --- a/app/src/main/res/layout/comment_adapter_row.xml +++ b/app/src/main/res/layout/comment_adapter_row.xml @@ -15,7 +15,6 @@ android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="?android:attr/textColorPrimary" android:textSize="16sp"/> diff --git a/app/src/main/res/layout/row_attribution.xml b/app/src/main/res/layout/row_attribution.xml index 00c0849ce..b70ac77d7 100644 --- a/app/src/main/res/layout/row_attribution.xml +++ b/app/src/main/res/layout/row_attribution.xml @@ -30,7 +30,6 @@ android:gravity="center_vertical" android:ellipsize="end" android:maxLines="1" - android:textColor="@color/text_primary" android:textSize="@dimen/sku_details_row_text_size"/> @color/text_primary @color/text_secondary @color/text_tertiary - @color/text_primary - @color/text_primary ?attr/overlay_theme @color/nnf_light_separator_color ?attr/colorAccent @@ -36,14 +34,10 @@ - +