From 0e506d1d0f71e43446a7c313dee2e31e460a1206 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Thu, 3 Mar 2022 18:55:38 +0530 Subject: [PATCH 1/2] UI: theme the app according to mockups --- res/drawable/ic_account_circle.xml | 2 +- res/drawable/ic_add.xml | 2 +- res/drawable/ic_create.xml | 2 +- res/drawable/ic_description.xml | 2 +- res/drawable/ic_info_outline.xml | 2 +- res/drawable/ic_menu_navigator.xml | 2 +- res/drawable/ic_settings.xml | 2 +- res/drawable/menu_selector.xml | 2 +- res/layout-sw600dp/agenda_day.xml | 2 +- res/layout/agenda_day.xml | 4 +- res/layout/all_in_one_material.xml | 7 +++- res/layout/app_bar.xml | 2 +- res/values-night/colors.xml | 13 ++++++- res/values/colors.xml | 26 +++++++------ res/values/dimens.xml | 7 ++++ res/values/styles.xml | 3 +- .../android/calendar/DayOfMonthDrawable.java | 2 +- .../calendar/month/MonthWeekEventsView.java | 38 +++++++++++++------ 18 files changed, 79 insertions(+), 41 deletions(-) diff --git a/res/drawable/ic_account_circle.xml b/res/drawable/ic_account_circle.xml index c85bb90b1..7b55736ff 100644 --- a/res/drawable/ic_account_circle.xml +++ b/res/drawable/ic_account_circle.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_add.xml b/res/drawable/ic_add.xml index fe7c5414e..9c6a2abe1 100644 --- a/res/drawable/ic_add.xml +++ b/res/drawable/ic_add.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_create.xml b/res/drawable/ic_create.xml index 7edd0d24b..ea1dc07dc 100644 --- a/res/drawable/ic_create.xml +++ b/res/drawable/ic_create.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_description.xml b/res/drawable/ic_description.xml index 9a8032321..3b3cfc6cb 100644 --- a/res/drawable/ic_description.xml +++ b/res/drawable/ic_description.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_info_outline.xml b/res/drawable/ic_info_outline.xml index 8f6eec516..2c8666e91 100755 --- a/res/drawable/ic_info_outline.xml +++ b/res/drawable/ic_info_outline.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_menu_navigator.xml b/res/drawable/ic_menu_navigator.xml index ddd88a311..f10a32f12 100644 --- a/res/drawable/ic_menu_navigator.xml +++ b/res/drawable/ic_menu_navigator.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_settings.xml b/res/drawable/ic_settings.xml index fc42a77b0..5d99a5a67 100644 --- a/res/drawable/ic_settings.xml +++ b/res/drawable/ic_settings.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/menu_selector.xml b/res/drawable/menu_selector.xml index 97aecb03f..1f421e802 100644 --- a/res/drawable/menu_selector.xml +++ b/res/drawable/menu_selector.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/res/layout-sw600dp/agenda_day.xml b/res/layout-sw600dp/agenda_day.xml index 3603c6732..9fb78b4eb 100644 --- a/res/layout-sw600dp/agenda_day.xml +++ b/res/layout-sw600dp/agenda_day.xml @@ -16,7 +16,7 @@ + app:titleTextColor="@color/appbar_text_color" + app:subtitleTextColor="@color/appbar_text_color"/> @@ -52,6 +54,7 @@ android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" + android:background="@color/navigation_drawer_color" app:menu="@menu/calendar_view" app:itemTextColor="@drawable/menu_selector" app:itemIconTint="@drawable/menu_selector" diff --git a/res/layout/app_bar.xml b/res/layout/app_bar.xml index 9c3eb315c..157a4bb53 100644 --- a/res/layout/app_bar.xml +++ b/res/layout/app_bar.xml @@ -7,6 +7,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" - app:titleTextColor="@color/color_default_primary_text" + app:titleTextColor="@color/appbar_text_color" app:theme="@style/Widget.CalendarAppTheme.ActionBar" app:titleTextAppearance="?attr/settings_titleText"/> diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml index b14414d39..ac084a51d 100644 --- a/res/values-night/colors.xml +++ b/res/values-night/colors.xml @@ -1,4 +1,15 @@ - #808080 + #2e2e2e + #5db2ff + #121212 + #1fffffff + #1fffffff + #bdffffff + #deffffff + #2e2e2e + #1fffffff + #2e2e2e + #363636 + #de000000 \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index 722227bfe..ccba5eb9a 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -19,19 +19,23 @@ --> - @lineageos.platform:color/color_default_primary + #fafafa @lineageos.platform:color/color_default_primary_dark - @lineageos.platform:color/color_default_accent + #0086ff @color/colorAccent @lineageos.platform:color/color_default_primary_text @lineageos.platform:color/color_default_secondary_text @lineageos.platform:color/color_default_view_on_accent - @lineageos.platform:color/color_default_selector + #145db2ff @lineageos.platform:color/color_default_gray2 - @lineageos.platform:color/color_default_foreground - @lineageos.platform:color/color_default_foreground2 + #fafafa + #eeeeee + #99000000 + #de000000 - #fafafa + #ffffff + + #f0f0f0 @color/date_strip_bg #f1922d #b36f28 @@ -82,8 +86,8 @@ @color/colorAccent - #FFCCCCCC - #FFCCCCCC + #14212121 + #14212121 #ff707070 @color/background_color @@ -101,7 +105,7 @@ #4C999999 @color/color_gray2 @color/color_gray2 - #ffdedede + #14212121 @color/color_default_secondary_text @@ -132,7 +136,7 @@ @color/color_default_primary_text - @color/colorPrimaryDark + @color/color_non_focus_item_bg #FFDDDDDD @@ -150,7 +154,7 @@ @color/color_default_secondary_text - #FFBBBBBB + @android:color/transparent @color/colorAccent diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 490a6f7f1..1a2d52315 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -56,4 +56,11 @@ 300dp 16dp + 13dp + 15dp + 12dp + 5dp + 7dp + 5dp + 3dp diff --git a/res/values/styles.xml b/res/values/styles.xml index 6e808c74a..c69bc80e9 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -82,8 +82,7 @@ diff --git a/src/com/android/calendar/DayOfMonthDrawable.java b/src/com/android/calendar/DayOfMonthDrawable.java index ab0bf18b2..905524c4a 100644 --- a/src/com/android/calendar/DayOfMonthDrawable.java +++ b/src/com/android/calendar/DayOfMonthDrawable.java @@ -44,7 +44,7 @@ public class DayOfMonthDrawable extends Drawable { mTextSize = c.getResources().getDimension(R.dimen.today_icon_text_size); mPaint = new Paint(); mPaint.setAlpha(255); - mPaint.setColor(c.getResources().getColor(R.color.colorAccent)); + mPaint.setColor(c.getResources().getColor(R.color.appbar_text_color)); mPaint.setTypeface(Typeface.DEFAULT_BOLD); mPaint.setTextSize(mTextSize); mPaint.setTextAlign(Paint.Align.CENTER); diff --git a/src/com/android/calendar/month/MonthWeekEventsView.java b/src/com/android/calendar/month/MonthWeekEventsView.java index 7d028175b..c48b962ed 100644 --- a/src/com/android/calendar/month/MonthWeekEventsView.java +++ b/src/com/android/calendar/month/MonthWeekEventsView.java @@ -28,6 +28,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.Paint.Style; +import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.provider.CalendarContract.Attendees; @@ -564,14 +565,6 @@ public class MonthWeekEventsView extends SimpleWeekView { canvas.drawRect(r, p); } if (mHasToday) { - int selectedColor = ContextCompat.getColor(mContext, DynamicTheme.getColorId(DynamicTheme.getPrimaryColor(mContext))); - - if (Utils.getSharedPreference(mContext, "pref_theme", "light").equals("light")) { - p.setColor(selectedColor); - p.setAlpha(72); - } else { - p.setColor(mMonthBGTodayColor); - } r.left = computeDayLeftPosition(mTodayIndex); r.right = computeDayLeftPosition(mTodayIndex + 1); canvas.drawRect(r, p); @@ -624,21 +617,42 @@ public class MonthWeekEventsView extends SimpleWeekView { Time time = new Time(mTimeZone); time.setJulianDay(julianMonday); + int current_date_text_x=getResources().getDimensionPixelSize(R.dimen.current_date_text_x); + int current_date_text_y=getResources().getDimensionPixelSize(R.dimen.current_date_text_y); + int current_date_event_margin=getResources().getDimensionPixelSize(R.dimen.current_date_text_event_margin); + for (; i < numCount; i++) { + x = computeDayLeftPosition(i - offset) - (mSidePaddingMonthNumber); if (mHasToday && todayIndex == i) { - mMonthNumPaint.setColor(mMonthNumTodayColor); - mMonthNumPaint.setFakeBoldText(isBold = true); + mMonthNumPaint.setFakeBoldText(isBold = false); if (i + 1 < numCount) { // Make sure the color will be set back on the next // iteration isFocusMonth = !mFocusDay[i + 1]; } + mMonthNumPaint.setColor(getContext().getResources().getColor(R.color.color_default_blue1)); + int current_date_bg_size=getResources().getDimensionPixelSize(R.dimen.current_date_bg_size); + + //check text width & height to calculate circle cx and cy values + Rect bounds = new Rect(); + mMonthNumPaint.getTextBounds(mDayNumbers[i], 0, mDayNumbers[i].length(), bounds); + + int text_height = bounds.height(); + int text_width = bounds.width(); + + canvas.drawCircle(x - current_date_text_x - (text_width / 2), + y + current_date_text_y - (text_height / 2) - current_date_event_margin, + current_date_bg_size, mMonthNumPaint); + mMonthNumPaint.setColor(mMonthNumTodayColor); } else if (mFocusDay[i] != isFocusMonth) { isFocusMonth = mFocusDay[i]; mMonthNumPaint.setColor(isFocusMonth ? mMonthNumColor : mMonthNumOtherColor); } - x = computeDayLeftPosition(i - offset) - (mSidePaddingMonthNumber); - canvas.drawText(mDayNumbers[i], x, y, mMonthNumPaint); + double relation = Math.sqrt(canvas.getWidth() * canvas.getHeight()); + mMonthNumPaint.setTextSize((int)relation / 12); + + canvas.drawText(mDayNumbers[i], x-current_date_text_x, + y+current_date_text_y - current_date_event_margin, mMonthNumPaint); if (isBold) { mMonthNumPaint.setFakeBoldText(isBold = false); } -- GitLab From 8b816a9ed17ada132ff7e55d08fac9e8683de463 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Mon, 7 Mar 2022 20:06:55 +0530 Subject: [PATCH 2/2] UI: theme the app according to mockups --- res/drawable/button_drawable.xml | 6 ++ res/drawable/ic_arrow_back.xml | 2 +- .../ic_baseline_calendar_dayofmonth.xml | 4 +- res/drawable/ic_colorpicker.xml | 2 +- res/drawable/ic_delete_event.xml | 2 +- res/drawable/ic_edit_event.xml | 2 +- res/drawable/ic_menu_cancel.xml | 4 +- res/drawable/ic_save_event.xml | 2 +- res/drawable/ic_share_event.xml | 2 +- res/drawable/today_icon.xml | 6 +- res/layout/all_in_one_material.xml | 4 +- res/layout/app_bar.xml | 1 + res/layout/edit_event_all.xml | 41 +++++++----- res/layout/edit_event_custom_actionbar.xml | 66 +++++++------------ res/values-night/colors.xml | 1 + res/values/colors.xml | 9 +-- res/values/styles.xml | 10 +-- .../android/calendar/DayOfMonthDrawable.java | 2 +- 18 files changed, 77 insertions(+), 89 deletions(-) create mode 100644 res/drawable/button_drawable.xml diff --git a/res/drawable/button_drawable.xml b/res/drawable/button_drawable.xml new file mode 100644 index 000000000..49032fe12 --- /dev/null +++ b/res/drawable/button_drawable.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/res/drawable/ic_arrow_back.xml b/res/drawable/ic_arrow_back.xml index 65eedbc3c..afa5b58fa 100644 --- a/res/drawable/ic_arrow_back.xml +++ b/res/drawable/ic_arrow_back.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_baseline_calendar_dayofmonth.xml b/res/drawable/ic_baseline_calendar_dayofmonth.xml index fd08d39ef..f75084640 100644 --- a/res/drawable/ic_baseline_calendar_dayofmonth.xml +++ b/res/drawable/ic_baseline_calendar_dayofmonth.xml @@ -1,5 +1,5 @@ - + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/res/drawable/ic_colorpicker.xml b/res/drawable/ic_colorpicker.xml index 56097317f..418be80e8 100644 --- a/res/drawable/ic_colorpicker.xml +++ b/res/drawable/ic_colorpicker.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_delete_event.xml b/res/drawable/ic_delete_event.xml index 0f54fac45..fadc29db2 100644 --- a/res/drawable/ic_delete_event.xml +++ b/res/drawable/ic_delete_event.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_edit_event.xml b/res/drawable/ic_edit_event.xml index bd6c5ea4b..db28c372a 100644 --- a/res/drawable/ic_edit_event.xml +++ b/res/drawable/ic_edit_event.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_menu_cancel.xml b/res/drawable/ic_menu_cancel.xml index 2f0d622a0..8099e3af9 100644 --- a/res/drawable/ic_menu_cancel.xml +++ b/res/drawable/ic_menu_cancel.xml @@ -1,5 +1,5 @@ - + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/res/drawable/ic_save_event.xml b/res/drawable/ic_save_event.xml index cd15e0201..361fc0d66 100644 --- a/res/drawable/ic_save_event.xml +++ b/res/drawable/ic_save_event.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/ic_share_event.xml b/res/drawable/ic_share_event.xml index 254cfc0ae..f2777172d 100644 --- a/res/drawable/ic_share_event.xml +++ b/res/drawable/ic_share_event.xml @@ -1,4 +1,4 @@ - diff --git a/res/drawable/today_icon.xml b/res/drawable/today_icon.xml index 87b7d69f1..dc982f307 100644 --- a/res/drawable/today_icon.xml +++ b/res/drawable/today_icon.xml @@ -18,11 +18,9 @@ + android:gravity="center"/> + android:gravity="center" /> diff --git a/res/layout/all_in_one_material.xml b/res/layout/all_in_one_material.xml index 3edcd5e2d..6f5fd131b 100644 --- a/res/layout/all_in_one_material.xml +++ b/res/layout/all_in_one_material.xml @@ -29,10 +29,12 @@ style="@style/Widget.CalendarAppTheme.ActionBar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" + android:elevation="4dp" app:popupTheme="@style/Widget.CalendarAppTheme.ActionBar.PopupTheme" android:minHeight="?attr/actionBarSize" app:titleTextColor="@color/appbar_text_color" - app:subtitleTextColor="@color/appbar_text_color"/> + app:subtitleTextColor="@color/appbar_text_color" + android:theme="@style/Widget.CalendarAppTheme.ActionBar"/> - + android:paddingTop="10dp"> + + + + app:layout_constraintTop_toBottomOf="@+id/title_row" /> - - - - - - + android:layout_height="?attr/actionBarSize"> + + - - - - +