diff --git a/.bundle/config b/.bundle/config index 2369228816d4..da970cb8c12e 100644 --- a/.bundle/config +++ b/.bundle/config @@ -1,2 +1,3 @@ --- BUNDLE_PATH: "vendor/bundle" +BUNDLE_WITHOUT: "screenshots" diff --git a/.circleci/config.yml b/.circleci/config.yml index 50b20b193b6d..645fe458ce84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ jobs: type: instrumentation apk-path: WordPress/build/outputs/apk/vanilla/debug/WordPress-vanilla-debug.apk test-apk-path: WordPress/build/outputs/apk/androidTest/vanilla/debug/WordPress-vanilla-debug-androidTest.apk - test-targets: package org.wordpress.android.e2e + test-targets: notPackage org.wordpress.android.ui.screenshots device: model=Nexus5X,version=26,locale=en,orientation=portrait project: api-project-108380595987 timeout: 10m diff --git a/Gemfile b/Gemfile index 06884cb123f5..8a26867409fc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # frozen_string_literal: true source "https://rubygems.org" do - gem 'fastlane', "2.126" + gem 'fastlane', "2.127.2" gem 'nokogiri' end diff --git a/Gemfile.lock b/Gemfile.lock index 85a78faee618..cab0a54298e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/wordpress-mobile/release-toolkit - revision: d5ad0466ab9f72161cd55916577cf52ee386f9cf - tag: 0.5.0 + revision: c555066402074a527a9853932790da8198eb7f21 + tag: 0.6.0 specs: - fastlane-plugin-wpmreleasetoolkit (0.5.0) + fastlane-plugin-wpmreleasetoolkit (0.6.0) diffy (~> 3.3) git (~> 1.3) jsonlint @@ -13,7 +13,6 @@ GIT progress_bar (~> 1.3) rake (~> 12.3) rake-compiler (~> 1.0) - rmagick (~> 3.0) GEM remote: https://rubygems.org/ @@ -32,11 +31,11 @@ GEM declarative-option (0.1.0) diffy (3.3.0) digest-crc (0.4.1) - domain_name (0.5.20180417) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.4) emoji_regex (1.0.1) - excon (0.64.0) + excon (0.65.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) @@ -45,7 +44,7 @@ GEM faraday_middleware (0.13.1) faraday (>= 0.7.4, < 1.0) fastimage (2.1.5) - fastlane (2.126.0) + fastlane (2.127.2) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -65,7 +64,7 @@ GEM highline (>= 1.7.2, < 2.0.0) json (< 3.0.0) jwt (~> 2.1.0) - mini_magick (~> 4.5.1) + mini_magick (>= 4.9.4, < 5.0.0) multi_xml (~> 0.5) multipart-post (~> 2.0.0) plist (>= 3.1.0, < 4.0.0) @@ -121,7 +120,7 @@ GEM mime-types (3.2.2) mime-types-data (~> 3.2015) mime-types-data (3.2019.0331) - mini_magick (4.5.1) + mini_magick (4.9.5) mini_portile2 (2.4.0) multi_json (1.13.1) multi_xml (0.6.0) @@ -132,7 +131,7 @@ GEM mini_portile2 (~> 2.4.0) octokit (4.14.0) sawyer (~> 0.8.0, >= 0.5.3) - oj (3.7.12) + oj (3.8.0) optimist (3.0.0) options (2.3.2) os (1.0.1) @@ -179,7 +178,7 @@ GEM unf_ext (0.0.7.6) unicode-display_width (1.6.0) word_wrap (1.0.0) - xcodeproj (1.10.0) + xcodeproj (1.11.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -194,9 +193,10 @@ PLATFORMS ruby DEPENDENCIES - fastlane (= 2.126)! + fastlane (= 2.127.2)! fastlane-plugin-wpmreleasetoolkit! nokogiri! + rmagick (~> 3.2.0) BUNDLED WITH 1.17.3 diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 298ddcee4676..f0b84945f6d6 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,5 +1,14 @@ +13.1 +----- + 13.0 ----- +* Block editor: Auto-enabled upon first open of a block post, unless opted out in v12.9. +* Block editor: You can now enable and disable the block editor on a per-site basis. +* Improve accessibility in the Stats +* Block editor: Adding a block from the post title now shows the add block here indicator. +* Block editor: Deselect post title any time a block is added +* Block editor: Fix loss of center alignment in image captions 12.9 ----- diff --git a/WordPress/build.gradle b/WordPress/build.gradle index c0eb77bb059b..66cb5653e0cd 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -24,6 +24,12 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'se.bjurr.violations.violation-comments-to-github-gradle-plugin' +apply plugin: 'kotlin-allopen' + +allOpen { + // allows mocking for classes w/o directly opening them for release builds + annotation 'org.wordpress.android.testing.OpenClassAnnotation' +} android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true @@ -43,17 +49,13 @@ android { defaultConfig { applicationId "org.wordpress.android" - versionName "alpha-180" - versionCode 754 + versionName "alpha-183" + versionCode 762 minSdkVersion 21 targetSdkVersion 28 multiDexEnabled true - ndk { - abiFilters 'armeabi-v7a', 'x86' - } - vectorDrawables.useSupportLibrary = true testInstrumentationRunner 'org.wordpress.android.WordPressTestRunner' @@ -72,8 +74,8 @@ android { productFlavors { vanilla { // used for release and beta dimension "buildType" - versionName "12.9-rc-1" - versionCode 753 + versionName "13.0-rc-1" + versionCode 761 } zalpha { // alpha version - enable experimental features diff --git a/WordPress/metadata/release_notes.txt b/WordPress/metadata/release_notes.txt index 5a344cf652d2..a38e62a19431 100644 --- a/WordPress/metadata/release_notes.txt +++ b/WordPress/metadata/release_notes.txt @@ -1,3 +1,5 @@ -* Customers with unclaimed domain credits can register domains in the app. -* You can expand the Comment Editor to Full Screen for more space while editing. -* The Block editor has a few improvements: Video blocks are available, and a some issues that led to content loss when using unsupported blocks have been resolved. +* Fixes a crash that could happen when viewing help from the login screen +* Allow setting which editor to use on a per-site basis +* Improves accessibility in stats +* Makes it easier to log in by validating the URL to your site more quickly. +* Some minor tweaks to the colour scheme diff --git a/WordPress/src/androidTest/java/org/wordpress/android/e2e/README.md b/WordPress/src/androidTest/java/org/wordpress/android/e2e/README.md new file mode 100644 index 000000000000..ea14feb7e804 --- /dev/null +++ b/WordPress/src/androidTest/java/org/wordpress/android/e2e/README.md @@ -0,0 +1,45 @@ +## UI tests Overview + +WordPress for Android has UI acceptance tests for critical user flows through the app, such as login, +signup, and publishing. The tests use mocked network requests with [WireMock](http://wiremock.org/), +defined in [WordPressMocks](https://github.com/wordpress-mobile/WordPressMocks). + +## Running the tests + +**Note that due to the mock server setup, tests cannot be run on physical devices right now.** + + +1. Follow the [build instructions](https://github.com/wordpress-mobile/WordPress-Android#build-instructions) + (steps 1-7) to clone, build and run the project in Android Studio. +2. Run the tests in `org.wordpress.android.e2e` + +There's no additional steps needed to make the tests run against the mock server -- that's configured by default. + +## Adding a new test? + +Great! When adding a new UI test, consider: + +* Whether you need to test a user flow (to accomplish a task or goal) or a specific feature (e.g. boundary testing). +* What screens/pages are being tested (defined in `pages/`). +* What user flows are being used (defined in `flows/`). +* Any specific UI components being interacted with?(defined in `components/`). +* What network requests are made during the test (defined in `libs/mocks/WordPressMocks`)). + +It's preferred to focus UI tests on entire user flows, and group tests with related flows or goals in the same test file. + +When you add a new test, you may need to add new screens, methods, and flows. When writing these I encourage you to check +`support/WPSupportUtils.java` for additional code to reuse to automate the task. Our tests are also used to generate screenshots +and a lot of useful helper functions are made available through that auxillary file. Wherever possible, avoid the use + of a string to select a UI element on the screen; the use of other identifiers such as id or content description is preferable + and should be used where possible, even if that means adding it to a UI element that might be missing the appropriate field. + This ensures tests can be run regardless of the device language. + +## Adding or updating network mocks + +When you add a test (or when the app changes), the request definitions for WireMock need to be updated. You can read WireMock’s documentation [here](http://wiremock.org/docs/). + +If you are unsure what network requests need to be mocked for a test, an easy way to find out is to run the app through [Charles Proxy](https://www.charlesproxy.com/) and observe the required requests. + +`WordPressMocks` is included as a library in `WordPress-Android` and are located in `libs/mocks/WordPressMocks/`, you can update +your local mock files and make changes here. Additionally a pull request updating the mocks +here should have an accompanying pull request to the `WordPressMocks` repo so that the mocks can be shared across the platforms. diff --git a/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/EditorPage.java b/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/EditorPage.java index 3de2b819d0ba..57e27bf2cb56 100644 --- a/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/EditorPage.java +++ b/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/EditorPage.java @@ -74,6 +74,8 @@ public void enterImage() { // Accept alert for media access clickOn(onView(withText("LEAVE OFF")).inRoot(isDialog())); } + + waitForElementToBeDisplayed(publishButton); } public void openSettings() { diff --git a/WordPress/src/debug/java/org/wordpress/android/testing/OpenForTesting.kt b/WordPress/src/debug/java/org/wordpress/android/testing/OpenForTesting.kt new file mode 100644 index 000000000000..d82b0ca911b2 --- /dev/null +++ b/WordPress/src/debug/java/org/wordpress/android/testing/OpenForTesting.kt @@ -0,0 +1,13 @@ +package org.wordpress.android.testing +/** + * This annotation allows us to open some classes in debug build only for mocking purposes while they are final in + * release builds. + */ +@Target(AnnotationTarget.ANNOTATION_CLASS) +annotation class OpenClassAnnotation +/** + * Annotate a class with [OpenForTesting] if you want it to be extendable in debug builds. + */ +@OpenClassAnnotation +@Target(AnnotationTarget.CLASS) +annotation class OpenForTesting diff --git a/WordPress/src/main/java/org/wordpress/android/WordPress.java b/WordPress/src/main/java/org/wordpress/android/WordPress.java index 6a1aad9e9e46..0a08742b4633 100644 --- a/WordPress/src/main/java/org/wordpress/android/WordPress.java +++ b/WordPress/src/main/java/org/wordpress/android/WordPress.java @@ -78,8 +78,8 @@ import org.wordpress.android.ui.stats.datasets.StatsDatabaseHelper; import org.wordpress.android.ui.stats.datasets.StatsTable; import org.wordpress.android.ui.stats.refresh.lists.widget.WidgetUpdater.StatsWidgetUpdaters; -import org.wordpress.android.ui.uploads.UploadStarter; import org.wordpress.android.ui.uploads.UploadService; +import org.wordpress.android.ui.uploads.UploadStarter; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.AppLogListener; import org.wordpress.android.util.AppLog.LogLevel; @@ -94,6 +94,7 @@ import org.wordpress.android.util.ProfilingUtils; import org.wordpress.android.util.QuickStartUtils; import org.wordpress.android.util.RateLimitedTask; +import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.UploadWorker; import org.wordpress.android.util.UploadWorkerKt; import org.wordpress.android.util.VolleyUtils; @@ -185,6 +186,11 @@ protected boolean run() { SiteModel selectedSite = mSiteStore.getSiteByLocalId(siteLocalId); if (selectedSite != null) { mDispatcher.dispatch(SiteActionBuilder.newFetchSiteAction(selectedSite)); + // Reload editor details from the remote backend + if (!AppPrefs.isDefaultAppWideEditorPreferenceSet()) { + // Check if the migration from app-wide to per-site setting has already happened - v12.9->13.0 + mDispatcher.dispatch(SiteActionBuilder.newFetchSiteEditorsAction(selectedSite)); + } } return true; } @@ -873,6 +879,9 @@ public void onAppComesFromBackground() { } sDeleteExpiredStats.runIfNotLimited(); + // Let's migrate the old editor preference if available in AppPrefs to the remote backend + SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(mContext, mDispatcher, mSiteStore); + if (mFirstActivityResumed) { deferredInit(); } diff --git a/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java b/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java index c833490b071c..448a4b51ced4 100644 --- a/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java +++ b/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java @@ -3,6 +3,8 @@ import org.wordpress.android.util.StringUtils; public class PublicizeService { + public static final String FACEBOOK_SERVICE_ID = "facebook"; + private String mId; private String mLabel; private String mDescription; diff --git a/WordPress/src/main/java/org/wordpress/android/push/GCMMessageService.java b/WordPress/src/main/java/org/wordpress/android/push/GCMMessageService.java index aa7d51917ecb..ac71c81a4cda 100644 --- a/WordPress/src/main/java/org/wordpress/android/push/GCMMessageService.java +++ b/WordPress/src/main/java/org/wordpress/android/push/GCMMessageService.java @@ -656,7 +656,7 @@ private NotificationCompat.Builder getNotificationBuilder(Context context, Strin return new NotificationCompat.Builder(context, context.getString(R.string.notification_channel_normal_id)) .setSmallIcon(R.drawable.ic_my_sites_white_24dp) - .setColor(context.getResources().getColor(R.color.primary_500)) + .setColor(context.getResources().getColor(R.color.primary_50)) .setContentTitle(title) .setContentText(message) .setTicker(message) @@ -711,7 +711,7 @@ private void showGroupNotificationForBuilder(Context context, NotificationCompat context.getString(R.string.notification_channel_normal_id)) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN) .setSmallIcon(R.drawable.ic_my_sites_white_24dp) - .setColor(context.getResources().getColor(R.color.primary_500)) + .setColor(context.getResources().getColor(R.color.primary_50)) .setGroup(NOTIFICATION_GROUP_KEY) .setGroupSummary(true) .setAutoCancel(true) @@ -987,7 +987,7 @@ private void handlePushAuth(Context context, Bundle data) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context, context.getString(R.string.notification_channel_important_id)) .setSmallIcon(R.drawable.ic_my_sites_white_24dp) - .setColor(context.getResources().getColor(R.color.primary_500)) + .setColor(context.getResources().getColor(R.color.primary_50)) .setContentTitle(title) .setContentText(message) .setAutoCancel(true) diff --git a/WordPress/src/main/java/org/wordpress/android/push/NativeNotificationsUtils.java b/WordPress/src/main/java/org/wordpress/android/push/NativeNotificationsUtils.java index 0a1d354cf688..4cd5cc459c3e 100644 --- a/WordPress/src/main/java/org/wordpress/android/push/NativeNotificationsUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/push/NativeNotificationsUtils.java @@ -41,7 +41,7 @@ public static void showMessageToUserWithBuilder(NotificationCompat.Builder build public static NotificationCompat.Builder getBuilder(Context context, String channelId) { return new NotificationCompat.Builder(context, channelId) .setSmallIcon(R.drawable.ic_my_sites_white_24dp) - .setColor(context.getResources().getColor(R.color.primary_500)) + .setColor(context.getResources().getColor(R.color.primary_50)) .setContentTitle(context.getString(R.string.app_name)) .setAutoCancel(true); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/AddQuickPressShortcutActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/AddQuickPressShortcutActivity.java index 0b8f4d47462f..f9bd2de2efcd 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/AddQuickPressShortcutActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/AddQuickPressShortcutActivity.java @@ -219,7 +219,7 @@ public View getView(int position, View convertView, ViewGroup parent) { StringEscapeUtils.unescapeHtml4(blogNames[position])); blogUsername.setText( StringEscapeUtils.unescapeHtml4(username)); - blavatar.setErrorImageResId(R.drawable.bg_rectangle_neutral_100_globe_32dp); + blavatar.setErrorImageResId(R.drawable.bg_rectangle_neutral_10_globe_32dp); blavatar.setImageUrl(blavatars[position], mImageLoader); return view; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/CollapseFullScreenDialogFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/CollapseFullScreenDialogFragment.java index b78994007305..04411af46329 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/CollapseFullScreenDialogFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/CollapseFullScreenDialogFragment.java @@ -270,7 +270,7 @@ public void onClick(View view) { if (!mAction.isEmpty()) { Menu menu = toolbar.getMenu(); mMenuAction = menu.add(0, ID_ACTION, 0, this.mAction); - mMenuAction.setIcon(R.drawable.ic_send_accent_neutral_300_24dp); + mMenuAction.setIcon(R.drawable.ic_send_accent_neutral_30_24dp); mMenuAction.setEnabled(false); mMenuAction.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mMenuAction.setOnMenuItemClickListener( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/JetpackRemoteInstallViewState.kt b/WordPress/src/main/java/org/wordpress/android/ui/JetpackRemoteInstallViewState.kt index 532fbe8d22ce..056b7f8de523 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/JetpackRemoteInstallViewState.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/JetpackRemoteInstallViewState.kt @@ -24,7 +24,7 @@ sealed class JetpackRemoteInstallViewState( R.string.install_jetpack, R.string.install_jetpack_message, icon = R.drawable.ic_plans_white_24dp, - iconTint = R.color.jetpack, + iconTint = R.color.jetpack_green_50, buttonResource = R.string.install_jetpack_continue, onClick = onClick ) @@ -34,7 +34,7 @@ sealed class JetpackRemoteInstallViewState( R.string.installing_jetpack, R.string.installing_jetpack_message, icon = R.drawable.ic_plans_white_24dp, - iconTint = R.color.jetpack, + iconTint = R.color.jetpack_green_50, progressBarVisible = true ) @@ -44,7 +44,7 @@ sealed class JetpackRemoteInstallViewState( R.string.jetpack_installed_message, icon = R.drawable.ic_plans_white_24dp, buttonResource = R.string.install_jetpack_continue, - iconTint = R.color.jetpack, + iconTint = R.color.jetpack_green_50, onClick = onClick ) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverFragment.java index 409ac9b4daf7..3bc6b17218ab 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverFragment.java @@ -171,14 +171,14 @@ public void run() { if (mRecyclerView.computeVerticalScrollRange() > mRecyclerView.getHeight()) { mBottomButtonsShadow.setVisibility(View.VISIBLE); mBottomButtonsContainer.setBackgroundResource(android.R.color.white); - mShareMediaBtn.setTextColor(getResources().getColor(R.color.primary_500)); + mShareMediaBtn.setTextColor(getResources().getColor(R.color.primary_50)); ViewUtils.setButtonBackgroundColor(getContext(), mShareMediaBtn, R.style.WordPress_Button_Grey, R.attr.colorButtonNormal); } else { mBottomButtonsShadow.setVisibility(View.GONE); mBottomButtonsContainer.setBackground(null); - mShareMediaBtn.setTextColor(getResources().getColor(R.color.neutral_700)); + mShareMediaBtn.setTextColor(getResources().getColor(R.color.neutral_70)); ViewUtils.setButtonBackgroundColor(getContext(), mShareMediaBtn, R.style.WordPress_Button, R.attr.colorButtonNormal); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/WPNumberPicker.java b/WordPress/src/main/java/org/wordpress/android/ui/WPNumberPicker.java index 521bdb8635b3..b57e0f0e3dc6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/WPNumberPicker.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/WPNumberPicker.java @@ -89,7 +89,7 @@ protected void onDraw(Canvas canvas) { Paint paint = mInputView.getPaint(); paint.setTextAlign(Paint.Align.CENTER); //noinspection deprecation - paint.setColor(getResources().getColor(R.color.primary_500)); + paint.setColor(getResources().getColor(R.color.primary_50)); int alpha = isEnabled() ? 255 : 96; paint.setAlpha(alpha); mPaint.setAlpha(alpha); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt index ddf8ba587f14..aafc2c146e43 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt @@ -20,6 +20,7 @@ import org.wordpress.android.ui.ActivityId import org.wordpress.android.ui.AppLogViewerActivity import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.util.LocaleManager +import org.wordpress.android.util.SiteUtils import java.util.ArrayList import javax.inject.Inject @@ -175,7 +176,7 @@ class HelpActivity : AppCompatActivity() { intent.putExtra(WordPress.SITE, selectedSite) } - val tagsList: ArrayList? = if (AppPrefs.isGutenbergDefaultForNewPosts()) { + val tagsList: ArrayList? = if (SiteUtils.isBlockEditorDefaultForNewPost(selectedSite)) { // construct a mutable list to add the Gutenberg related extra tag val list = ArrayList() diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java index ff0ea0cf5736..8eb612a7a3d2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java @@ -826,4 +826,15 @@ private void dismissSignupSheet() { public AndroidInjector supportFragmentInjector() { return mFragmentInjector; } + + @Override public void showHelpFindingConnectedEmail() { + // Not used in WordPress app + } + + @Override public void gotConnectedSiteInfo( + @NonNull String siteAddress, + @Nullable String redirectUrl, + boolean hasJetpack) { + // Not used in WordPress app + } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java b/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java index 3fd1b6bcb983..c9af77eb8258 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java @@ -236,4 +236,18 @@ public void trackUsernamePasswordFormViewed() { public void trackWpComBackgroundServiceUpdate(Map properties) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_WPCOM_BACKGROUND_SERVICE_UPDATE, properties); } + + @Override public void trackConnectedSiteInfoRequested(String url) { + // Not used in WordPress app + } + + @Override + public void trackConnectedSiteInfoFailed(String url, String errorContext, String errorType, + String errorDescription) { + // Not used in WordPress app + } + + @Override public void trackConnectedSiteInfoSucceeded(Map properties) { + // Not used in WordPress app + } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListItem.kt index 3d312f0f5813..1f4761acbf6b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListItem.kt @@ -72,10 +72,10 @@ sealed class ActivityLogListItem(val type: ViewType) { } enum class Status(val value: String, @DrawableRes val color: Int) { - NEGATIVE("error", R.drawable.bg_oval_error_500), - INFO("warning", R.drawable.bg_oval_primary_500), - POSITIVE("success", R.drawable.bg_oval_success_500), - NEUTRAL("", R.drawable.bg_oval_neutral_300); + NEGATIVE("error", R.drawable.bg_oval_error_50), + INFO("warning", R.drawable.bg_oval_primary_50), + POSITIVE("success", R.drawable.bg_oval_success_50), + NEUTRAL("", R.drawable.bg_oval_neutral_30); companion object { private val map = values().associateBy(Status::value) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/EventItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/EventItemViewHolder.kt index 8204d773d904..42e5d668ba69 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/EventItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/EventItemViewHolder.kt @@ -38,7 +38,7 @@ class EventItemViewHolder( if (activity.isButtonVisible) { ContextCompat.getDrawable(container.context, activity.buttonIcon.drawable)?.let { buttonIcon -> val wrapDrawable = DrawableCompat.wrap(buttonIcon).mutate() - DrawableCompat.setTint(wrapDrawable, ContextCompat.getColor(container.context, R.color.primary_400)) + DrawableCompat.setTint(wrapDrawable, ContextCompat.getColor(container.context, R.color.primary_40)) actionButton.setImageDrawable(DrawableCompat.unwrap(wrapDrawable)) actionButton.visibility = View.VISIBLE } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentAdapter.java index b7d156001db1..4f7c8e47d296 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentAdapter.java @@ -136,7 +136,7 @@ public boolean onLongClick(View v) { mStatusColorUnapproved = ContextCompat.getColor(context, R.color.accent); mUnselectedColor = ContextCompat.getColor(context, android.R.color.white); - mSelectedColor = ContextCompat.getColor(context, R.color.gray_50); + mSelectedColor = ContextCompat.getColor(context, R.color.gray_5); mStatusTextSpam = context.getResources().getString(R.string.comment_status_spam); mStatusTextUnapproved = context.getResources().getString(R.string.comment_status_unapproved); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentDetailFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentDetailFragment.java index 49b470dcc6aa..dccdbcb832e8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentDetailFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentDetailFragment.java @@ -757,7 +757,7 @@ public void onClick(View v) { txtName.setOnClickListener(authorListener); txtName.setTextColor(ContextCompat.getColor(getActivity(), R.color.link_reader)); } else { - txtName.setTextColor(ContextCompat.getColor(getActivity(), R.color.neutral_600)); + txtName.setTextColor(ContextCompat.getColor(getActivity(), R.color.neutral_60)); } showPostTitle(mSite, mComment.getRemotePostId()); @@ -1000,11 +1000,11 @@ private void updateStatusViews() { switch (commentStatus) { case APPROVED: statusTextResId = R.string.comment_status_approved; - statusColor = ContextCompat.getColor(getActivity(), R.color.warning_600); + statusColor = ContextCompat.getColor(getActivity(), R.color.warning_60); break; case UNAPPROVED: statusTextResId = R.string.comment_status_unapproved; - statusColor = ContextCompat.getColor(getActivity(), R.color.warning_600); + statusColor = ContextCompat.getColor(getActivity(), R.color.warning_60); break; case SPAM: statusTextResId = R.string.comment_status_spam; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentsListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentsListFragment.java index b8e05da5d703..3e3e2638a5e9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentsListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/comments/CommentsListFragment.java @@ -379,9 +379,9 @@ public void onShowCustomEmptyView(EmptyViewMessageType emptyViewMsgType) { }); // the following will change the look and feel of the toolbar to match the current design - mFilteredCommentsView.setToolbarBackgroundColor(ContextCompat.getColor(getActivity(), R.color.primary_400)); + mFilteredCommentsView.setToolbarBackgroundColor(ContextCompat.getColor(getActivity(), R.color.primary_40)); mFilteredCommentsView.setToolbarSpinnerTextColor(ContextCompat.getColor(getActivity(), android.R.color.white)); - mFilteredCommentsView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_blue_light_24dp); + mFilteredCommentsView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_primary_30_24dp); mFilteredCommentsView.setToolbarLeftAndRightPadding( getResources().getDimensionPixelSize(R.dimen.margin_filter_spinner), getResources().getDimensionPixelSize(R.dimen.margin_none)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/domains/DomainRegistrationDetailsFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/domains/DomainRegistrationDetailsFragment.kt index 25e08a6836cd..5b1217f8e1a5 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/domains/DomainRegistrationDetailsFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/domains/DomainRegistrationDetailsFragment.kt @@ -293,8 +293,13 @@ class DomainRegistrationDetailsFragment : Fragment() { country_input, address_first_line_input, city_input, postal_code_input ) + var fieldToFocusOn: TextInputEditText? = null + requiredFields.forEach { if (TextUtils.isEmpty(it.text)) { + if (fieldToFocusOn == null) { + fieldToFocusOn = it + } showEmptyFieldError(it) if (formIsCompleted) { formIsCompleted = false @@ -302,6 +307,9 @@ class DomainRegistrationDetailsFragment : Fragment() { } } + // focusing on first empty field + fieldToFocusOn?.requestFocus() + return formIsCompleted } @@ -423,7 +431,11 @@ class DomainRegistrationDetailsFragment : Fragment() { } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - viewModel = ViewModelProviders.of(activity!!, viewModelFactory) + if (targetFragment == null) { + throw IllegalStateException("StatePickerDialogFragment is missing a targetFragment ") + } + + viewModel = ViewModelProviders.of(targetFragment!!, viewModelFactory) .get(DomainRegistrationDetailsViewModel::class.java) val builder = AlertDialog.Builder(requireContext()) builder.setTitle(R.string.domain_registration_state_picker_dialog_title) @@ -469,7 +481,11 @@ class DomainRegistrationDetailsFragment : Fragment() { } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - viewModel = ViewModelProviders.of(activity!!, viewModelFactory) + if (targetFragment == null) { + throw IllegalStateException("CountryPickerDialogFragment is missing a targetFragment ") + } + + viewModel = ViewModelProviders.of(targetFragment!!, viewModelFactory) .get(DomainRegistrationDetailsViewModel::class.java) val builder = AlertDialog.Builder(requireContext()) builder.setTitle(R.string.domain_registration_country_picker_dialog_title) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java index f42bb7ab1dc3..f694bc95c197 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java @@ -608,12 +608,12 @@ private void updateQuickStartContainer() { countCustomizeCompleted, countCustomizeCompleted + countCustomizeUncompleted)); if (countGrowUncompleted > 0) { - mQuickStartGrowIcon.setBackgroundResource(R.drawable.bg_oval_pink_500_multiple_users_white_40dp); + mQuickStartGrowIcon.setBackgroundResource(R.drawable.bg_oval_pink_50_multiple_users_white_40dp); mQuickStartGrowTitle.setEnabled(true); mQuickStartGrowTitle.setPaintFlags( mQuickStartGrowTitle.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } else { - mQuickStartGrowIcon.setBackgroundResource(R.drawable.bg_oval_neutral_300_multiple_users_white_40dp); + mQuickStartGrowIcon.setBackgroundResource(R.drawable.bg_oval_neutral_30_multiple_users_white_40dp); mQuickStartGrowTitle.setEnabled(false); mQuickStartGrowTitle.setPaintFlags( mQuickStartGrowTitle.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java index 76cc9635e4d3..703c863b9938 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java @@ -54,6 +54,7 @@ import org.wordpress.android.util.DeviceUtils; import org.wordpress.android.util.LocaleManager; import org.wordpress.android.util.NetworkUtils; +import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.ToastUtils; import org.wordpress.android.util.helpers.Debouncer; import org.wordpress.android.util.helpers.SwipeToRefreshHelper; @@ -220,6 +221,21 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { } break; } + + // Enable the block editor on sites created on mobile + switch (requestCode) { + case RequestCodes.CREATE_SITE: + if (data != null) { + int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); + SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID); + // Mark the site to show the GB popup at first editor run + SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID); + if (newSiteModel != null) { + AppPrefs.setShowGutenbergInfoPopup(newSiteModel.getUrl(), true); + } + } + break; + } } @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerAdapter.java index f1060c587fcb..e44490bb66d0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerAdapter.java @@ -156,11 +156,11 @@ public SitePickerAdapter(Context context, mDataLoadedListener = dataLoadedListener; mBlavatarSz = context.getResources().getDimensionPixelSize(R.dimen.blavatar_sz); - mTextColorNormal = context.getResources().getColor(R.color.neutral_700); - mTextColorHidden = context.getResources().getColor(R.color.neutral_300); + mTextColorNormal = context.getResources().getColor(R.color.neutral_70); + mTextColorHidden = context.getResources().getColor(R.color.neutral_30); mSelectedItemBackground = - new ColorDrawable(context.getResources().getColor(R.color.gray_50)); + new ColorDrawable(context.getResources().getColor(R.color.gray_5)); mHeaderHandler = headerHandler; mSelectedItemPos = getPositionOffset(); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java index 96b32a7ae0a8..31b69f315faf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java @@ -51,6 +51,7 @@ import org.wordpress.android.fluxc.store.SiteStore.CompleteQuickStartPayload; import org.wordpress.android.fluxc.store.SiteStore.OnQuickStartCompleted; import org.wordpress.android.fluxc.store.SiteStore.OnSiteChanged; +import org.wordpress.android.fluxc.store.SiteStore.OnSiteEditorsChanged; import org.wordpress.android.fluxc.store.SiteStore.OnSiteRemoved; import org.wordpress.android.login.LoginAnalyticsListener; import org.wordpress.android.networking.ConnectionChangeReceiver; @@ -98,6 +99,7 @@ import org.wordpress.android.util.ProfilingUtils; import org.wordpress.android.util.QuickStartUtils; import org.wordpress.android.util.ShortcutUtils; +import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.ToastUtils; import org.wordpress.android.util.WPActivityUtils; import org.wordpress.android.util.analytics.AnalyticsUtils; @@ -770,6 +772,17 @@ public void onClick(View v) { QuickStartUtils.cancelQuickStartReminder(this); AppPrefs.setQuickStartNoticeRequired(false); + // Enable the block editor on sites created on mobile + if (data != null) { + int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); + SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID); + // Mark the site to show the GB popup at first editor run + SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID); + if (newSiteModel != null) { + AppPrefs.setShowGutenbergInfoPopup(newSiteModel.getUrl(), true); + } + } + setSite(data); showQuickStartDialog(); break; @@ -1135,6 +1148,32 @@ public void onSiteChanged(OnSiteChanged event) { } } + @SuppressWarnings("unused") + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSiteEditorsChanged(OnSiteEditorsChanged event) { + // When the site editor details are loaded from the remote backend, make sure to set a default if empty + if (event.isError()) { + return; + } + + // "Reload" selected site from the db + // It would be better if the OnSiteChanged provided the list of changed sites. + if (getSelectedSite() == null && mSiteStore.hasSite()) { + setSelectedSite(mSiteStore.getSites().get(0)); + } + if (getSelectedSite() == null) { + return; + } + + SiteModel site = mSiteStore.getSiteByLocalId(getSelectedSite().getId()); + if (site != null) { + mSelectedSite = site; + } + if (getMySiteFragment() != null) { + getMySiteFragment().onSiteChanged(site); + } + } + @SuppressWarnings("unused") @Subscribe(threadMode = ThreadMode.MAIN) public void onSiteRemoved(OnSiteRemoved event) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaBrowserActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaBrowserActivity.java index d9427bba4ffc..0d6fe25717e2 100755 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaBrowserActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaBrowserActivity.java @@ -246,7 +246,7 @@ private void formatQuotaDiskSpace() { mQuotaText.setText(getString(R.string.media_space_used, quota)); mQuotaText.setTextColor( - getResources().getColor(mSite.getSpacePercentUsed() > 90 ? R.color.error_500 : R.color.neutral)); + getResources().getColor(mSite.getSpacePercentUsed() > 90 ? R.color.error_50 : R.color.neutral)); } private void showQuota(boolean show) { @@ -286,7 +286,7 @@ private void enableTabs(boolean enable) { private void setupTabs() { if (shouldShowTabs()) { - int normalColor = ContextCompat.getColor(this, R.color.primary_300); + int normalColor = ContextCompat.getColor(this, R.color.primary_30); int selectedColor = ContextCompat.getColor(this, android.R.color.white); mTabLayout.setTabTextColors(normalColor, selectedColor); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java index 4357af3d5819..42f213c0ce5c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java @@ -191,7 +191,7 @@ public void onBindViewHolder(GridViewHolder holder, int position) { holder.mFileTypeView.setText(fileExtension.toUpperCase(Locale.ROOT)); int placeholderResId = WPMediaUtils.getPlaceholder(fileName); ColorUtils.INSTANCE.setImageResourceWithTint(holder.mFileTypeImageView, placeholderResId, - R.color.neutral_300); + R.color.neutral_30); mImageManager.cancelRequestAndClearImageView(holder.mImageView); } holder.mImageView.setContentDescription(mContext.getString(R.string.media_grid_item_image_desc, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridFragment.java index 55df594b850c..ce9f593f387b 100755 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridFragment.java @@ -791,7 +791,7 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) { inflater.inflate(R.menu.media_multiselect, menu); setSwipeToRefreshEnabled(false); getAdapter().setInMultiSelect(true); - WPActivityUtils.setStatusBarColor(getActivity().getWindow(), R.color.neutral_600); + WPActivityUtils.setStatusBarColor(getActivity().getWindow(), R.color.neutral_60); updateActionModeTitle(selectCount); return true; } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java index 53bfff348288..b62a296d168f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java @@ -380,7 +380,7 @@ private boolean loadMedia(MediaModel media) { int padding = getResources().getDimensionPixelSize(R.dimen.margin_extra_extra_large); @DrawableRes int imageRes = WPMediaUtils.getPlaceholder(mMedia.getUrl()); ColorUtils.INSTANCE.setImageResourceWithTint(mImageView, - imageRes != 0 ? imageRes : R.drawable.ic_pages_white_24dp, R.color.neutral_300); + imageRes != 0 ? imageRes : R.drawable.ic_pages_white_24dp, R.color.neutral_30); mImageView.setPadding(padding, padding * 2, padding, padding); mImageView.setImageResource(imageRes); } else { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.java index 6ca738005aa1..1e7366cb225e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.java @@ -287,9 +287,9 @@ public void onBindViewHolder(NoteViewHolder noteViewHolder, int position) { if (commentStatus == CommentStatus.UNAPPROVED) { noteViewHolder.mNoteIcon.setBackgroundResource(R.drawable.bg_oval_warning_stroke_white); } else if (isUnread) { - noteViewHolder.mNoteIcon.setBackgroundResource(R.drawable.bg_oval_primary_400_stroke_notification_unread); + noteViewHolder.mNoteIcon.setBackgroundResource(R.drawable.bg_oval_primary_40_stroke_notification_unread); } else { - noteViewHolder.mNoteIcon.setBackgroundResource(R.drawable.bg_oval_neutral_200_stroke_white); + noteViewHolder.mNoteIcon.setBackgroundResource(R.drawable.bg_oval_neutral_20_stroke_white); } if (isUnread) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/CommentUserNoteBlock.java b/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/CommentUserNoteBlock.java index 5b4c65ba3713..b1080bdc2bb7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/CommentUserNoteBlock.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/CommentUserNoteBlock.java @@ -250,10 +250,10 @@ public void configureResources(Context context) { return; } - mNormalTextColor = context.getResources().getColor(R.color.neutral_700); + mNormalTextColor = context.getResources().getColor(R.color.neutral_70); mNormalBackgroundColor = context.getResources().getColor(android.R.color.white); mAgoTextColor = context.getResources().getColor(R.color.neutral); - mUnapprovedTextColor = context.getResources().getColor(R.color.warning_600); + mUnapprovedTextColor = context.getResources().getColor(R.color.warning_60); // Double margin_extra_large for increased indent in comment replies mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2; } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockClickableSpan.java b/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockClickableSpan.java index 2915a4061f2a..a4d60d002b80 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockClickableSpan.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockClickableSpan.java @@ -43,10 +43,10 @@ public NoteBlockClickableSpan(Context context, FormattableRange range, boolean s mIsFooter = isFooter; // Text/background colors - mTextColor = context.getResources().getColor(R.color.neutral_700); - mBackgroundColor = context.getResources().getColor(R.color.primary_50); - mLinkColor = context.getResources().getColor(R.color.primary_400); - mLightTextColor = context.getResources().getColor(R.color.neutral_700); + mTextColor = context.getResources().getColor(R.color.neutral_70); + mBackgroundColor = context.getResources().getColor(R.color.primary_5); + mLinkColor = context.getResources().getColor(R.color.primary_40); + mLightTextColor = context.getResources().getColor(R.color.neutral_70); processRangeData(range); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/pages/PageItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/pages/PageItemViewHolder.kt index 888c7e7fffcb..02b72bce40c6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/pages/PageItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/pages/PageItemViewHolder.kt @@ -144,7 +144,7 @@ sealed class PageItemViewHolder(internal val parent: ViewGroup, @LayoutRes layou @Suppress("DEPRECATION") CompoundButtonCompat.setButtonTintList(radioButton, - radioButton.resources.getColorStateList(R.color.primary_400_gray_200_gray_400_selector)) + radioButton.resources.getColorStateList(R.color.primary_40_gray_20_gray_40_selector)) } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java index 0d4355c1ee5b..da25040cad55 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java @@ -513,8 +513,8 @@ private void styleButton(String username, @Nullable String validationResultMessa TextView textView = (TextView) mUsernameButtons.get(username).findViewById(R.id.username); textView.setTextColor(ContextCompat.getColor(getActivity(), - validationResultMessage == null ? R.color.neutral_700 - : (validationResultMessage.equals(FLAG_SUCCESS) ? R.color.primary_500 : R.color.error_500))); + validationResultMessage == null ? R.color.neutral_70 + : (validationResultMessage.equals(FLAG_SUCCESS) ? R.color.primary_50 : R.color.error_50))); } private diff --git a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleListFragment.java index ac7be6fe2f34..3b1b386c5151 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleListFragment.java @@ -113,9 +113,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa mFilteredRecyclerView.setSwipeToRefreshEnabled(false); // the following will change the look and feel of the toolbar to match the current design - mFilteredRecyclerView.setToolbarBackgroundColor(ContextCompat.getColor(getActivity(), R.color.primary_400)); + mFilteredRecyclerView.setToolbarBackgroundColor(ContextCompat.getColor(getActivity(), R.color.primary_40)); mFilteredRecyclerView.setToolbarSpinnerTextColor(ContextCompat.getColor(getActivity(), android.R.color.white)); - mFilteredRecyclerView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_blue_light_24dp); + mFilteredRecyclerView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_primary_30_24dp); mFilteredRecyclerView.setToolbarLeftAndRightPadding( getResources().getDimensionPixelSize(R.dimen.margin_filter_spinner), getResources().getDimensionPixelSize(R.dimen.margin_none)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerFragment.java index 69292010a54b..6fd4e4b174b3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerFragment.java @@ -452,7 +452,7 @@ private final class ActionModeCallback implements ActionMode.Callback { @Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { mActionMode = actionMode; - WPActivityUtils.setStatusBarColor(getActivity().getWindow(), R.color.neutral_600); + WPActivityUtils.setStatusBarColor(getActivity().getWindow(), R.color.neutral_60); MenuInflater inflater = actionMode.getMenuInflater(); inflater.inflate(R.menu.photo_picker_action_mode, menu); hideBottomBar(); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginBrowserActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginBrowserActivity.java index 373553141052..09eef92f9eea 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginBrowserActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginBrowserActivity.java @@ -423,19 +423,19 @@ public void onBindViewHolder(ViewHolder viewHolder, int position) { boolean isAutoManaged = PluginUtils.isAutoManaged(mViewModel.getSite(), plugin); if (isAutoManaged) { textResId = R.string.plugin_auto_managed; - colorResId = R.color.success_500; + colorResId = R.color.success_50; drawableResId = android.R.color.transparent; } else if (PluginUtils.isUpdateAvailable(plugin)) { textResId = R.string.plugin_needs_update; - colorResId = R.color.warning_500; + colorResId = R.color.warning_50; drawableResId = R.drawable.ic_sync_white_24dp; } else if (plugin.isActive()) { textResId = R.string.plugin_active; - colorResId = R.color.success_500; + colorResId = R.color.success_50; drawableResId = R.drawable.ic_checkmark_white_24dp; } else { textResId = R.string.plugin_inactive; - colorResId = R.color.neutral_300; + colorResId = R.color.neutral_30; drawableResId = R.drawable.ic_cross_white_24dp; } holder.mStatusText.setText(textResId); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginDetailActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginDetailActivity.java index ce7cadd9b712..854b58990df6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginDetailActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginDetailActivity.java @@ -661,11 +661,11 @@ private void refreshViews() { private void setCollapsibleHtmlText(@NonNull TextView textView, @Nullable String htmlText) { if (!TextUtils.isEmpty(htmlText)) { - textView.setTextColor(getResources().getColor(R.color.neutral_700)); + textView.setTextColor(getResources().getColor(R.color.neutral_70)); textView.setMovementMethod(WPLinkMovementMethod.getInstance()); textView.setText(Html.fromHtml(htmlText)); } else { - textView.setTextColor(getResources().getColor(R.color.neutral_200)); + textView.setTextColor(getResources().getColor(R.color.neutral_20)); textView.setText(R.string.plugin_empty_text); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginListFragment.java index a5373c5a2d7f..9fdcbbeaf560 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/plugins/PluginListFragment.java @@ -267,19 +267,19 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { @DrawableRes int drawableResId; if (PluginUtils.isAutoManaged(mViewModel.getSite(), plugin)) { textResId = R.string.plugin_auto_managed; - colorResId = R.color.success_500; + colorResId = R.color.success_50; drawableResId = android.R.color.transparent; } else if (PluginUtils.isUpdateAvailable(plugin)) { textResId = R.string.plugin_needs_update; - colorResId = R.color.warning_500; + colorResId = R.color.warning_50; drawableResId = R.drawable.ic_sync_white_24dp; } else if (plugin.isActive()) { textResId = R.string.plugin_active; - colorResId = R.color.success_500; + colorResId = R.color.success_50; drawableResId = R.drawable.ic_checkmark_white_24dp; } else { textResId = R.string.plugin_inactive; - colorResId = R.color.neutral_300; + colorResId = R.color.neutral_30; drawableResId = R.drawable.ic_cross_white_24dp; } int color = getResources().getColor(colorResId); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index abe31f2d9203..5cb3baa0c007 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -409,6 +409,15 @@ protected void onCreate(Bundle savedInstanceState) { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } + // FIXME: Make sure to use the latest fresh info about the site we've in the DB + // set only the editor setting for now. + if (mSite != null) { + SiteModel refreshedSite = mSiteStore.getSiteByLocalId(mSite.getId()); + if (refreshedSite != null) { + mSite.setMobileEditor(refreshedSite.getMobileEditor()); + } + } + // Check whether to show the visual editor PreferenceManager.setDefaultValues(this, R.xml.account_settings, false); mShowAztecEditor = AppPrefs.isAztecEditorEnabled(); @@ -516,7 +525,7 @@ protected void onCreate(Bundle savedInstanceState) { restartEditorOptionName == null ? RestartEditorOptions.RESTART_DONT_SUPPRESS_GUTENBERG : RestartEditorOptions.valueOf(restartEditorOptionName); - mShowGutenbergEditor = PostUtils.shouldShowGutenbergEditor(mIsNewPost, mPost) + mShowGutenbergEditor = PostUtils.shouldShowGutenbergEditor(mIsNewPost, mPost, mSite) && restartEditorOption != RestartEditorOptions.RESTART_SUPPRESS_GUTENBERG; } else { mShowGutenbergEditor = savedInstanceState.getBoolean(STATE_KEY_GUTENBERG_IS_SHOWN); @@ -1253,8 +1262,10 @@ public boolean onPrepareOptionsMenu(Menu menu) { // if content has blocks or empty, offer the switch to Gutenberg. The block editor doesn't have good // "Classic Block" support yet so, don't offer a switch to it if content doesn't have blocks. If the post - // is empty but the user hasn't enabled "Use Gutenberg for new posts" App setting, don't offer the switch. - switchToGutenbergMenuItem.setVisible(hasBlocks || (AppPrefs.isGutenbergDefaultForNewPosts() && isEmpty)); + // is empty but the user hasn't enabled "Use Gutenberg for new posts" in Site Setting, + // don't offer the switch. + switchToGutenbergMenuItem.setVisible( + hasBlocks || (SiteUtils.isBlockEditorDefaultForNewPost(mSite) && isEmpty)); } return super.onPrepareOptionsMenu(menu); @@ -1539,11 +1550,10 @@ private void showGutenbergInformativeDialog() { } private void setGutenbergEnabledIfNeeded() { - if (AppPrefs.isGutenbergAutoEnabledForTheNewPosts() - && !mIsNewPost - && !AppPrefs.isGutenbergDefaultForNewPosts()) { - AppPrefs.setGutenbergDefaultForNewPosts(true); - AppPrefs.setGutenbergAutoEnabledForTheNewPosts(false); + if ((TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) + || AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl())) { + SiteUtils.enableBlockEditor(mDispatcher, mSite); + AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite); showGutenbergInformativeDialog(); } } @@ -2281,7 +2291,8 @@ public Fragment getItem(int position) { case 0: // TODO: Remove editor options after testing. if (mShowGutenbergEditor) { - // Enable gutenberg upon opening a block based post + // Enable gutenberg on the site & show the informative popup upon opening + // the GB editor the first time when the remote setting value is still null setGutenbergEnabledIfNeeded(); String languageString = LocaleManager.getLanguage(EditPostActivity.this); String wpcomLocaleSlug = languageString.replace("_", "-").toLowerCase(Locale.ENGLISH); @@ -3799,13 +3810,13 @@ public void onJavaScriptAlert(String url, String message) { ((GutenbergEditorFragment) mEditorFragment).resetUploadingMediaToFailed(mediaIds); } } else if (mShowAztecEditor && mEditorFragment instanceof AztecEditorFragment) { - mPostEditorAnalyticsSession.start(false); + mPostEditorAnalyticsSession.start(null); } } @Override - public void onEditorFragmentContentReady(boolean hasUnsupportedContent) { - mPostEditorAnalyticsSession.start(hasUnsupportedContent); + public void onEditorFragmentContentReady(ArrayList unsupportedBlocksList) { + mPostEditorAnalyticsSession.start(unsupportedBlocksList); } @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/HistoryListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/HistoryListFragment.kt index 87b0c9eff277..252d1d79727a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/HistoryListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/HistoryListFragment.kt @@ -31,13 +31,13 @@ class HistoryListFragment : Fragment() { @Inject lateinit var viewModelFactory: ViewModelProvider.Factory companion object { - private const val KEY_POST = "key_post" + private const val KEY_POST_LOCAL_ID = "key_post_local_id" private const val KEY_SITE = "key_site" fun newInstance(@NonNull post: PostModel, @NonNull site: SiteModel): HistoryListFragment { val fragment = HistoryListFragment() val bundle = Bundle() - bundle.putSerializable(KEY_POST, post) + bundle.putInt(KEY_POST_LOCAL_ID, post.id) bundle.putSerializable(KEY_SITE, site) fragment.arguments = bundle return fragment @@ -80,18 +80,16 @@ class HistoryListFragment : Fragment() { (nonNullActivity.application as WordPress).component()?.inject(this) viewModel = ViewModelProviders.of(this, viewModelFactory).get(HistoryViewModel::class.java) - viewModel.create(arguments?.get(KEY_POST) as PostModel, arguments?.get(KEY_SITE) as SiteModel) + viewModel.create( + localPostId = arguments?.getInt(KEY_POST_LOCAL_ID) ?: 0, + site = arguments?.get(KEY_SITE) as SiteModel + ) updatePostOrPageEmptyView() setObservers() } private fun updatePostOrPageEmptyView() { actionable_empty_view.title.text = getString(R.string.history_empty_title) - actionable_empty_view.subtitle.text = if ((arguments?.get(KEY_POST) as PostModel).isPage) { - getString(R.string.history_empty_subtitle_page) - } else { - getString(R.string.history_empty_subtitle_post) - } actionable_empty_view.button.visibility = View.GONE actionable_empty_view.subtitle.visibility = View.VISIBLE } @@ -151,5 +149,13 @@ class HistoryListFragment : Fragment() { (activity as HistoryItemClickInterface).onHistoryItemClicked(it, viewModel.revisionsList) } }) + + viewModel.post.observe(this, Observer { post -> + actionable_empty_view.subtitle.text = if (post?.isPage == true) { + getString(R.string.history_empty_subtitle_page) + } else { + getString(R.string.history_empty_subtitle_post) + } + }) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostEditorAnalyticsSession.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostEditorAnalyticsSession.java index c43bde54d655..80de85f39a1b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostEditorAnalyticsSession.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostEditorAnalyticsSession.java @@ -6,8 +6,10 @@ import org.wordpress.android.fluxc.model.SiteModel; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; +import org.wordpress.android.util.SiteUtils; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -18,6 +20,7 @@ public class PostEditorAnalyticsSession implements Serializable { private static final String KEY_CONTENT_TYPE = "content_type"; private static final String KEY_EDITOR = "editor"; private static final String KEY_HAS_UNSUPPORTED_BLOCKS = "has_unsupported_blocks"; + private static final String KEY_UNSUPPORTED_BLOCKS = "unsupported_blocks"; private static final String KEY_POST_TYPE = "post_type"; private static final String KEY_OUTCOME = "outcome"; private static final String KEY_SESSION_ID = "session_id"; @@ -70,16 +73,18 @@ enum Outcome { if (isNewPost) { mContentType = "new"; } else if (PostUtils.contentContainsGutenbergBlocks(postContent)) { - mContentType = "gutenberg"; + mContentType = SiteUtils.GB_EDITOR_NAME; } else { mContentType = "classic"; } } - public void start(boolean hasUnsupportedBlocks) { + public void start(ArrayList unsupportedBlocksList) { if (!mStarted) { - mHasUnsupportedBlocks = hasUnsupportedBlocks; + mHasUnsupportedBlocks = unsupportedBlocksList != null && unsupportedBlocksList.size() > 0; Map properties = getCommonProperties(); + properties.put(KEY_UNSUPPORTED_BLOCKS, + unsupportedBlocksList != null ? unsupportedBlocksList : new ArrayList<>()); AnalyticsTracker.track(Stat.EDITOR_SESSION_START, properties); mStarted = true; } else { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFeaturedImageTracker.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFeaturedImageTracker.kt index 60c3485cdb78..7e4f135be0de 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFeaturedImageTracker.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFeaturedImageTracker.kt @@ -6,8 +6,6 @@ import org.wordpress.android.fluxc.model.MediaModel import org.wordpress.android.fluxc.model.SiteModel import org.wordpress.android.fluxc.store.MediaStore import org.wordpress.android.fluxc.store.MediaStore.MediaPayload -import org.wordpress.android.ui.reader.utils.ReaderImageScanner -import org.wordpress.android.util.SiteUtils /** * This is a temporary class to make the PostListViewModel more manageable. Please feel free to refactor it any way @@ -16,9 +14,9 @@ import org.wordpress.android.util.SiteUtils class PostListFeaturedImageTracker(private val dispatcher: Dispatcher, private val mediaStore: MediaStore) { private val featuredImageMap = HashMap() - fun getFeaturedImageUrl(site: SiteModel, featuredImageId: Long, postContent: String): String? { + fun getFeaturedImageUrl(site: SiteModel, featuredImageId: Long): String? { if (featuredImageId == 0L) { - return ReaderImageScanner(postContent, !SiteUtils.isPhotonCapable(site)).largestImage + return null } featuredImageMap[featuredImageId]?.let { return it } mediaStore.getSiteMediaWithId(site, featuredImageId)?.let { media -> diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt index f0032d7989de..73f3c320cea7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListFragment.kt @@ -26,7 +26,6 @@ import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.ui.utils.UiString import org.wordpress.android.util.DisplayUtils import org.wordpress.android.util.NetworkUtils -import org.wordpress.android.util.SiteUtils import org.wordpress.android.util.ToastUtils import org.wordpress.android.util.WPSwipeToRefreshHelper.buildSwipeToRefreshHelper import org.wordpress.android.util.helpers.SwipeToRefreshHelper @@ -63,23 +62,11 @@ class PostListFragment : Fragment() { private lateinit var postListType: PostListType private lateinit var nonNullActivity: FragmentActivity - private lateinit var site: SiteModel - - private val postViewHolderConfig: PostViewHolderConfig by lazy { - val displayWidth = DisplayUtils.getDisplayPixelWidth(context) - val contentSpacing = nonNullActivity.resources.getDimensionPixelSize(R.dimen.content_margin) - PostViewHolderConfig( - photonWidth = displayWidth - contentSpacing * 2, - photonHeight = nonNullActivity.resources.getDimensionPixelSize(R.dimen.reader_featured_image_height), - isPhotonCapable = SiteUtils.isPhotonCapable(site), - imageManager = imageManager - ) - } private val postListAdapter: PostListAdapter by lazy { PostListAdapter( context = nonNullActivity, - postViewHolderConfig = postViewHolderConfig, + imageManager = imageManager, uiHelpers = uiHelpers ) } @@ -89,18 +76,12 @@ class PostListFragment : Fragment() { nonNullActivity = checkNotNull(activity) (nonNullActivity.application as WordPress).component().inject(this) - val site: SiteModel? = if (savedInstanceState == null) { - val nonNullIntent = checkNotNull(nonNullActivity.intent) - nonNullIntent.getSerializableExtra(WordPress.SITE) as SiteModel? - } else { - savedInstanceState.getSerializable(WordPress.SITE) as SiteModel? - } + val nonNullIntent = checkNotNull(nonNullActivity.intent) + val site: SiteModel? = nonNullIntent.getSerializableExtra(WordPress.SITE) as SiteModel? if (site == null) { ToastUtils.showToast(nonNullActivity, R.string.blog_not_found, ToastUtils.Duration.SHORT) nonNullActivity.finish() - } else { - this.site = site } } @@ -136,7 +117,13 @@ class PostListFragment : Fragment() { val postListViewModelConnector = mainViewModel.getPostListViewModelConnector(authorFilter, postListType) viewModel = ViewModelProviders.of(this, viewModelFactory).get(PostListViewModel::class.java) - viewModel.start(postListViewModelConnector) + + val displayWidth = DisplayUtils.getDisplayPixelWidth(context) + val contentSpacing = nonNullActivity.resources.getDimensionPixelSize(R.dimen.content_margin) + viewModel.start( + postListViewModelConnector, photonWidth = displayWidth - contentSpacing * 2, + photonHeight = nonNullActivity.resources.getDimensionPixelSize(R.dimen.reader_featured_image_height) + ) initObservers() } @@ -173,11 +160,6 @@ class PostListFragment : Fragment() { }) } - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putSerializable(WordPress.SITE, site) - } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val view = inflater.inflate(R.layout.post_list_fragment, container, false) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListItemViewHolder.kt index f65654e85cbd..02a6f0ac5215 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListItemViewHolder.kt @@ -15,10 +15,9 @@ import androidx.annotation.LayoutRes import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import org.wordpress.android.R -import org.wordpress.android.ui.reader.utils.ReaderUtils import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.ui.utils.UiString -import org.wordpress.android.util.ImageUtils +import org.wordpress.android.util.image.ImageManager import org.wordpress.android.util.image.ImageType import org.wordpress.android.viewmodel.posts.PostListItemAction import org.wordpress.android.viewmodel.posts.PostListItemAction.MoreItem @@ -34,7 +33,7 @@ import org.wordpress.android.widgets.WPTextView sealed class PostListItemViewHolder( @LayoutRes layout: Int, parent: ViewGroup, - private val config: PostViewHolderConfig, + private val imageManager: ImageManager, private val uiHelpers: UiHelpers ) : RecyclerView.ViewHolder(LayoutInflater.from(parent.context).inflate(layout, parent, false)) { private val featuredImageView: ImageView = itemView.findViewById(R.id.image_featured) @@ -53,9 +52,9 @@ sealed class PostListItemViewHolder( class Standard( parent: ViewGroup, - config: PostViewHolderConfig, + imageManager: ImageManager, private val uiHelpers: UiHelpers - ) : PostListItemViewHolder(R.layout.post_list_item, parent, config, uiHelpers) { + ) : PostListItemViewHolder(R.layout.post_list_item, parent, imageManager, uiHelpers) { private val excerptTextView: WPTextView = itemView.findViewById(R.id.excerpt) private val actionButtons: List = listOf( itemView.findViewById(R.id.btn_primary), @@ -96,9 +95,9 @@ sealed class PostListItemViewHolder( class Compact( parent: ViewGroup, - config: PostViewHolderConfig, + imageManager: ImageManager, private val uiHelpers: UiHelpers - ) : PostListItemViewHolder(R.layout.post_list_item_compact, parent, config, uiHelpers) { + ) : PostListItemViewHolder(R.layout.post_list_item_compact, parent, imageManager, uiHelpers) { private val moreButton: ImageButton = itemView.findViewById(R.id.more_button) override fun onBind(item: PostListItemUiState) { @@ -171,26 +170,12 @@ sealed class PostListItemViewHolder( // Suppress blinking as the media upload progresses return } - if (imageUrl == null) { + if (imageUrl.isNullOrBlank()) { featuredImageView.visibility = View.GONE - config.imageManager.cancelRequestAndClearImageView(featuredImageView) - } else if (imageUrl.startsWith("http")) { - val photonUrl = ReaderUtils.getResizedImageUrl( - imageUrl, config.photonWidth, config.photonHeight, !config.isPhotonCapable - ) - featuredImageView.visibility = View.VISIBLE - config.imageManager.load(featuredImageView, ImageType.PHOTO, photonUrl, ScaleType.CENTER_CROP) + imageManager.cancelRequestAndClearImageView(featuredImageView) } else { - val bmp = ImageUtils.getWPImageSpanThumbnailFromFilePath( - featuredImageView.context, imageUrl, config.photonWidth - ) - if (bmp != null) { - featuredImageView.visibility = View.VISIBLE - config.imageManager.load(featuredImageView, bmp) - } else { - featuredImageView.visibility = View.GONE - config.imageManager.cancelRequestAndClearImageView(featuredImageView) - } + featuredImageView.visibility = View.VISIBLE + imageManager.load(featuredImageView, ImageType.PHOTO, imageUrl, ScaleType.CENTER_CROP) } loadedFeaturedImgUrl = imageUrl } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewState.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewState.kt index 46e6242d4bbe..c3d80e20a831 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewState.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewState.kt @@ -60,7 +60,7 @@ fun getAuthorFilterItems( ME -> AuthorFilterListItemUIState.Me(avatarUrl, backgroundColorRes) EVERYONE -> AuthorFilterListItemUIState.Everyone( backgroundColorRes, - R.drawable.bg_oval_neutral_300_multiple_users_white_40dp + R.drawable.bg_oval_neutral_30_multiple_users_white_40dp ) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java index feb1873518b9..28ade12c6541 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostUtils.java @@ -18,11 +18,11 @@ import org.wordpress.android.fluxc.model.post.PostLocation; import org.wordpress.android.fluxc.model.post.PostStatus; import org.wordpress.android.fluxc.store.PostStore; -import org.wordpress.android.ui.prefs.AppPrefs; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.DateTimeUtils; import org.wordpress.android.util.HtmlUtils; import org.wordpress.android.util.LocaleManager; +import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.analytics.AnalyticsUtils; import org.wordpress.android.util.helpers.MediaFile; @@ -154,10 +154,8 @@ public static void trackSavePostAnalytics(PostModel post, SiteModel site) { } else { properties.put("word_count", AnalyticsUtils.getWordCount(post.getContent())); properties.put("editor_source", - shouldShowGutenbergEditor(post.isLocalDraft(), post) ? "gutenberg" - : (AppPrefs.isAztecEditorEnabled() ? "aztec" - : AppPrefs.isVisualEditorEnabled() ? "hybrid" : "legacy")); - + shouldShowGutenbergEditor(post.isLocalDraft(), post, site) + ? SiteUtils.GB_EDITOR_NAME : SiteUtils.AZTEC_EDITOR_NAME); properties.put(AnalyticsUtils.HAS_GUTENBERG_BLOCKS_KEY, PostUtils.contentContainsGutenbergBlocks(post.getContent())); AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.EDITOR_SCHEDULED_POST, site, @@ -382,12 +380,12 @@ public static boolean contentContainsGutenbergBlocks(String postContent) { return (postContent != null && postContent.contains(GUTENBERG_BLOCK_START)); } - public static boolean shouldShowGutenbergEditor(boolean isNewPost, PostModel post) { + public static boolean shouldShowGutenbergEditor(boolean isNewPost, PostModel post, SiteModel site) { // Default to Gutenberg if (isNewPost || TextUtils.isEmpty(post.getContent())) { - // for a new post, use Gutenberg if the "use for new posts" switch is set - return AppPrefs.isGutenbergDefaultForNewPosts(); + // For a new post, use Gutenberg if the "use for new posts" switch is set + return SiteUtils.isBlockEditorDefaultForNewPost(site); } else { // for already existing (and non-empty) posts, open Gutenberg only if the post contains blocks return contentContainsGutenbergBlocks(post.getContent()); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolderConfig.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolderConfig.kt deleted file mode 100644 index b4a11f69579b..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostViewHolderConfig.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.wordpress.android.ui.posts - -import org.wordpress.android.util.image.ImageManager - -class PostViewHolderConfig( - val photonWidth: Int, - val photonHeight: Int, - val isPhotonCapable: Boolean, - val imageManager: ImageManager -) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/adapters/PostListAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/adapters/PostListAdapter.kt index 56ae9300d149..dba0a98b973d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/adapters/PostListAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/adapters/PostListAdapter.kt @@ -14,8 +14,8 @@ import org.wordpress.android.ui.posts.PostListItemViewHolder import org.wordpress.android.ui.posts.PostListViewLayoutType import org.wordpress.android.ui.posts.PostListViewLayoutType.COMPACT import org.wordpress.android.ui.posts.PostListViewLayoutType.STANDARD -import org.wordpress.android.ui.posts.PostViewHolderConfig import org.wordpress.android.ui.utils.UiHelpers +import org.wordpress.android.util.image.ImageManager import org.wordpress.android.viewmodel.posts.PostListItemProgressBar import org.wordpress.android.viewmodel.posts.PostListItemType import org.wordpress.android.viewmodel.posts.PostListItemType.EndListIndicatorItem @@ -30,7 +30,7 @@ private const val VIEW_TYPE_LOADING_COMPACT = 4 class PostListAdapter( context: Context, - private val postViewHolderConfig: PostViewHolderConfig, + private val imageManager: ImageManager, private val uiHelpers: UiHelpers ) : PagedListAdapter(PostListDiffItemCallback) { private val layoutInflater: LayoutInflater = LayoutInflater.from(context) @@ -69,10 +69,10 @@ class PostListAdapter( LoadingViewHolder(view) } VIEW_TYPE_POST -> { - PostListItemViewHolder.Standard(parent, postViewHolderConfig, uiHelpers) + PostListItemViewHolder.Standard(parent, imageManager, uiHelpers) } VIEW_TYPE_POST_COMPACT -> { - PostListItemViewHolder.Compact(parent, postViewHolderConfig, uiHelpers) + PostListItemViewHolder.Compact(parent, imageManager, uiHelpers) } else -> { // Fail fast if a new view type is added so the we can handle it diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java index d5e1661ec8fc..fa4abc47472e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java @@ -24,7 +24,9 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; public class AppPrefs { private static final int THEME_IMAGE_SIZE_WIDTH_DEFAULT = 400; @@ -646,21 +648,71 @@ public static boolean isGutenbergEditorEnabled() { return true; } - public static boolean isGutenbergAutoEnabledForTheNewPosts() { - return getBoolean(DeletablePrefKey.SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS, true); + public static boolean isGutenbergDefaultForNewPosts() { + return getBoolean(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS, false); } - public static void setGutenbergAutoEnabledForTheNewPosts(boolean enable) { - setBoolean(DeletablePrefKey.SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS, enable); + public static boolean isDefaultAppWideEditorPreferenceSet() { + // Check if the default editor pref was previously set + return !"".equals(getString(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS)); } - public static boolean isGutenbergDefaultForNewPosts() { - return getBoolean(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS, false); + public static void removeAppWideEditorPreference() { + remove(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS); + } + + public static boolean shouldShowGutenbergInfoPopup(String siteURL) { + if (TextUtils.isEmpty(siteURL)) { + return false; + } + + Set urls; + try { + urls = prefs().getStringSet(DeletablePrefKey.SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS.name(), null); + } catch (ClassCastException exp) { + // no operation - This should not happen. + return false; + } + // Check if the current site address is available in the set. + boolean flag = false; + if (urls != null) { + if (urls.contains(siteURL)) { + flag = true; + // remove the flag from Prefs + setShowGutenbergInfoPopup(siteURL, false); + } + } + + return flag; } - public static void setGutenbergDefaultForNewPosts(boolean defaultForNewPosts) { - AnalyticsTracker.track(defaultForNewPosts ? Stat.EDITOR_GUTENBERG_ENABLED : Stat.EDITOR_GUTENBERG_DISABLED); - setBoolean(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS, defaultForNewPosts); + public static void setShowGutenbergInfoPopup(String siteURL, boolean show) { + if (TextUtils.isEmpty(siteURL)) { + return; + } + Set urls; + try { + urls = prefs().getStringSet(DeletablePrefKey.SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS.name(), null); + } catch (ClassCastException exp) { + // nope - this should never happens + return; + } + + Set newUrls = new HashSet<>(); + // re-add the old urls here + if (urls != null) { + newUrls.addAll(urls); + } + + // 1. First remove & 2. add if necessary + newUrls.remove(siteURL); + if (show) { + newUrls.add(siteURL); + } + + SharedPreferences.Editor editor = prefs().edit(); + editor.putStringSet(DeletablePrefKey.SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS.name(), newUrls); + editor.apply(); } public static void setVideoOptimizeWidth(int width) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java index a4b9d47f4ce7..b4ed181c5ab7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java @@ -50,10 +50,6 @@ public class AppSettingsFragment extends PreferenceFragment implements OnPreferenceClickListener, Preference.OnPreferenceChangeListener { public static final int LANGUAGE_CHANGED = 1000; - private static final int IDX_LEGACY_EDITOR = 0; - private static final int IDX_VISUAL_EDITOR = 1; - private static final int IDX_AZTEC_EDITOR = 2; - private DetailListPreference mLanguagePreference; // This Device settings @@ -61,7 +57,6 @@ public class AppSettingsFragment extends PreferenceFragment private DetailListPreference mImageMaxSizePref; private DetailListPreference mImageQualityPref; private WPSwitchPreference mOptimizedVideo; - private WPSwitchPreference mGutenbergDefaultForNewPosts; private DetailListPreference mVideoWidthPref; private DetailListPreference mVideoEncorderBitratePref; private PreferenceScreen mPrivacySettings; @@ -126,9 +121,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { (WPSwitchPreference) WPPrefUtils .getPrefAndSetChangeListener(this, R.string.pref_key_optimize_video, this); - mGutenbergDefaultForNewPosts = - (WPSwitchPreference) WPPrefUtils - .getPrefAndSetChangeListener(this, R.string.pref_key_gutenberg_default_for_new_posts, this); mVideoWidthPref = (DetailListPreference) WPPrefUtils .getPrefAndSetChangeListener(this, R.string.pref_key_site_video_width, this); @@ -159,7 +151,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { String.valueOf(AppPrefs.getVideoOptimizeQuality()), getLabelForVideoEncoderBitrateValue(AppPrefs.getVideoOptimizeQuality())); - mGutenbergDefaultForNewPosts.setChecked(AppPrefs.isGutenbergDefaultForNewPosts()); mStripImageLocation.setChecked(AppPrefs.isStripImageLocation()); if (!BuildConfig.OFFER_GUTENBERG) { @@ -300,10 +291,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { setDetailListPreferenceValue(mVideoEncorderBitratePref, newValue.toString(), getLabelForVideoEncoderBitrateValue(AppPrefs.getVideoOptimizeQuality())); - } else if (preference == mGutenbergDefaultForNewPosts) { - AppPrefs.setGutenbergDefaultForNewPosts((Boolean) newValue); - // we need to refresh metadata as gutenberg_enabled is now part of the user data - AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); } else if (preference == mStripImageLocation) { AppPrefs.setStripImageLocation((Boolean) newValue); } @@ -318,66 +305,6 @@ public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } - private void updateEditorSettings() { - if (!AppPrefs.isVisualEditorAvailable()) { - PreferenceScreen preferenceScreen = - (PreferenceScreen) findPreference(getActivity().getString(R.string.pref_key_account_settings_root)); - PreferenceCategory editor = (PreferenceCategory) findPreference(getActivity() - .getString( - R.string.pref_key_editor)); - if (preferenceScreen != null && editor != null) { - preferenceScreen.removePreference(editor); - } - } else { - final DetailListPreference editorTypePreference = - (DetailListPreference) findPreference(getActivity().getString(R.string.pref_key_editor_type)); - - editorTypePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(final Preference preference, final Object value) { - if (value != null) { - int index = Integer.parseInt(value.toString()); - CharSequence[] entries = editorTypePreference.getEntries(); - editorTypePreference.setSummary(entries[index]); - // we need to set value manually for DetailListPreference - editorTypePreference.setValue(value.toString()); - - switch (index) { - case IDX_VISUAL_EDITOR: - AppPrefs.setAztecEditorEnabled(false); - AppPrefs.setVisualEditorEnabled(true); - break; - case IDX_AZTEC_EDITOR: - AppPrefs.setAztecEditorEnabled(true); - AppPrefs.setVisualEditorEnabled(false); - break; - default: - AppPrefs.setAztecEditorEnabled(false); - AppPrefs.setVisualEditorEnabled(false); - break; - } - return true; - } else { - return false; - } - } - }); - - final int editorTypeSetting; - if (AppPrefs.isAztecEditorEnabled()) { - editorTypeSetting = IDX_AZTEC_EDITOR; - } else if (AppPrefs.isVisualEditorEnabled()) { - editorTypeSetting = IDX_VISUAL_EDITOR; - } else { - editorTypeSetting = IDX_LEGACY_EDITOR; - } - - CharSequence[] entries = editorTypePreference.getEntries(); - editorTypePreference.setSummary(entries[editorTypeSetting]); - editorTypePreference.setValueIndex(editorTypeSetting); - } - } - private void changeLanguage(String languageCode) { if (mLanguagePreference == null || TextUtils.isEmpty(languageCode)) { return; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/DetailListPreference.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/DetailListPreference.java index 8ee4848f7243..5bdc2678e06c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/DetailListPreference.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/DetailListPreference.java @@ -66,9 +66,9 @@ protected void onBindView(@NonNull View view) { super.onBindView(view); setupView((TextView) view.findViewById(android.R.id.title), - R.dimen.text_sz_large, R.color.neutral_700, R.color.neutral_200); + R.dimen.text_sz_large, R.color.neutral_70, R.color.neutral_20); setupView((TextView) view.findViewById(android.R.id.summary), - R.dimen.text_sz_medium, R.color.neutral, R.color.neutral_200); + R.dimen.text_sz_medium, R.color.neutral, R.color.neutral_20); } @Override @@ -142,12 +142,12 @@ public void onClick(DialogInterface dialog, int which) { if (positive != null) { //noinspection deprecation - positive.setTextColor(res.getColor(R.color.primary_400)); + positive.setTextColor(res.getColor(R.color.primary_40)); } if (negative != null) { //noinspection deprecation - negative.setTextColor(res.getColor(R.color.primary_400)); + negative.setTextColor(res.getColor(R.color.primary_40)); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/EditTextPreferenceWithValidation.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/EditTextPreferenceWithValidation.java index eb9b0a9db3ed..68664c520ccf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/EditTextPreferenceWithValidation.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/EditTextPreferenceWithValidation.java @@ -49,7 +49,7 @@ public void onClick(View v) { }); positiveButton.setTextColor(ContextCompat.getColorStateList(getContext(), - R.color.primary_400_neutral_400_selector)); + R.color.primary_40_neutral_40_selector)); getEditText().addTextChangedListener(new TextWatcher() { @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFormatDialog.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFormatDialog.java index c469036a9f2c..d8f840a069c6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFormatDialog.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFormatDialog.java @@ -126,7 +126,7 @@ private void createRadioButtons() { for (int i = 0; i < mEntries.length; i++) { RadioButton radio = new RadioButton(getActivity()); CompoundButtonCompat.setButtonTintList(radio, - getResources().getColorStateList(R.color.primary_400_gray_200_gray_400_selector)); + getResources().getColorStateList(R.color.primary_40_gray_20_gray_40_selector)); radio.setText(mEntries[i]); radio.setId(i); mRadioGroup.addView(radio); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java index 22ea3f176c42..853bbf92bfd2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java @@ -59,6 +59,7 @@ import org.wordpress.android.R; import org.wordpress.android.WordPress; import org.wordpress.android.analytics.AnalyticsTracker; +import org.wordpress.android.analytics.AnalyticsTracker.Stat; import org.wordpress.android.fluxc.Dispatcher; import org.wordpress.android.fluxc.generated.SiteActionBuilder; import org.wordpress.android.fluxc.model.SiteModel; @@ -183,6 +184,7 @@ public class SiteSettingsFragment extends PreferenceFragment private EditTextPreferenceWithValidation mPasswordPref; // Writing settings + private WPSwitchPreference mGutenbergDefaultForNewPosts; private DetailListPreference mCategoryPref; private DetailListPreference mFormatPref; private WPPreference mDateFormatPref; @@ -732,6 +734,17 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { } else if (preference == mTimezonePref) { setTimezonePref(newValue.toString()); mSiteSettings.setTimezone(newValue.toString()); + } else if (preference == mGutenbergDefaultForNewPosts) { + if (((Boolean) newValue)) { + SiteUtils.enableBlockEditor(mDispatcher, mSite); + } else { + SiteUtils.disableBlockEditor(mDispatcher, mSite); + } + AnalyticsUtils.trackWithSiteDetails( + ((Boolean) newValue) ? Stat.EDITOR_GUTENBERG_ENABLED : Stat.EDITOR_GUTENBERG_DISABLED, + mSite); + // we need to refresh metadata as gutenberg_enabled is now part of the user data + AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); } else { return false; } @@ -900,6 +913,9 @@ public void initPreferences() { mLazyLoadImages = (WPSwitchPreference) getChangePref(R.string.pref_key_lazy_load_images); mSiteQuotaSpacePref = (EditTextPreference) getChangePref(R.string.pref_key_site_quota_space); sortLanguages(); + mGutenbergDefaultForNewPosts = + (WPSwitchPreference) getChangePref(R.string.pref_key_gutenberg_default_for_new_posts); + mGutenbergDefaultForNewPosts.setChecked(SiteUtils.isBlockEditorDefaultForNewPost(mSite)); boolean isAccessedViaWPComRest = SiteUtils.isAccessedViaWPComRest(mSite); @@ -938,7 +954,8 @@ public void setEditingEnabled(boolean enabled) { mThreadingPref, mMultipleLinksPref, mModerationHoldPref, mBlacklistPref, mWeekStartPref, mDateFormatPref, mTimeFormatPref, mTimezonePref, mPostsPerPagePref, mAmpPref, mDeleteSitePref, mJpMonitorActivePref, mJpMonitorEmailNotesPref, mJpSsoPref, - mJpMonitorWpNotesPref, mJpBruteForcePref, mJpWhitelistPref, mJpMatchEmailPref, mJpUseTwoFactorPref + mJpMonitorWpNotesPref, mJpBruteForcePref, mJpWhitelistPref, mJpMatchEmailPref, mJpUseTwoFactorPref, + mGutenbergDefaultForNewPosts }; for (Preference preference : editablePreference) { @@ -1244,6 +1261,7 @@ public void setPreferencesFromSiteSettings() { mWeekStartPref.setSummary(mWeekStartPref.getEntry()); mServeImagesFromOurServers.setChecked(mSiteSettings.isServeImagesFromOurServersEnabled()); mLazyLoadImages.setChecked(mSiteSettings.isLazyLoadImagesEnabled()); + mGutenbergDefaultForNewPosts.setChecked(SiteUtils.isBlockEditorDefaultForNewPost(mSite)); if (mSiteSettings.getAmpSupported()) { mAmpPref.setChecked(mSiteSettings.getAmpEnabled()); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java index e12ae897ffb5..13328b3f1b2e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java @@ -21,6 +21,7 @@ import org.wordpress.android.fluxc.model.SiteModel; import org.wordpress.android.fluxc.store.SiteStore; import org.wordpress.android.fluxc.store.SiteStore.OnPostFormatsChanged; +import org.wordpress.android.fluxc.store.SiteStore.OnSiteEditorsChanged; import org.wordpress.android.models.CategoryModel; import org.wordpress.android.models.JetpackSettingsModel; import org.wordpress.android.models.SiteSettingsModel; @@ -948,6 +949,7 @@ public SiteSettingsInterface init(boolean fetchRemote) { if (fetchRemote) { fetchRemoteData(); mDispatcher.dispatch(SiteActionBuilder.newFetchPostFormatsAction(mSite)); + mDispatcher.dispatch(SiteActionBuilder.newFetchSiteEditorsAction(mSite)); } return this; @@ -1126,4 +1128,15 @@ public void onPostFormatsChanged(OnPostFormatsChanged event) { } notifyUpdatedOnUiThread(); } + + @SuppressWarnings("unused") + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSiteEditorsChanged(OnSiteEditorsChanged event) { + // When the site editor details are loaded from the remote backend, make sure to set a default if empty + if (event.isError()) { + return; + } + + notifyUpdatedOnUiThread(); + } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsTimezoneDialog.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsTimezoneDialog.java index 842d8382bfa8..541b4f9179c2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsTimezoneDialog.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsTimezoneDialog.java @@ -327,7 +327,7 @@ public View getView(int position, View convertView, ViewGroup parent) { boolean isSelected = mSelectedTimezone != null && mSelectedTimezone.equals(mFilteredTimezones.get(position).mValue); - int colorRes = isSelected ? R.color.primary_300 : android.R.color.transparent; + int colorRes = isSelected ? R.color.primary_30 : android.R.color.transparent; holder.mTxtLabel.setBackgroundColor(getResources().getColor(colorRes)); holder.mTxtLabel.setText(mFilteredTimezones.get(position).mLabel); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPPreference.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPPreference.java index 539ec01bfae7..529e200ebf61 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPPreference.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPPreference.java @@ -41,11 +41,11 @@ protected void onBindView(@NonNull View view) { TextView summaryView = (TextView) view.findViewById(android.R.id.summary); if (titleView != null) { titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.text_sz_large)); - titleView.setTextColor(res.getColor(isEnabled() ? R.color.neutral_700 : R.color.neutral_200)); + titleView.setTextColor(res.getColor(isEnabled() ? R.color.neutral_70 : R.color.neutral_20)); } if (summaryView != null) { summaryView.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.text_sz_medium)); - summaryView.setTextColor(res.getColor(isEnabled() ? R.color.neutral : R.color.neutral_200)); + summaryView.setTextColor(res.getColor(isEnabled() ? R.color.neutral : R.color.neutral_20)); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPSwitchPreference.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPSwitchPreference.java index 17a6ee7522da..dcccd481be6a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPSwitchPreference.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/WPSwitchPreference.java @@ -55,7 +55,7 @@ protected void onBindView(@NonNull View view) { if (titleView != null) { Resources res = getContext().getResources(); titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.text_sz_large)); - titleView.setTextColor(res.getColor(isEnabled() ? R.color.neutral_700 : R.color.neutral_200)); + titleView.setTextColor(res.getColor(isEnabled() ? R.color.neutral_70 : R.color.neutral_20)); // add padding to the start of nested preferences if (!TextUtils.isEmpty(getDependency())) { @@ -68,9 +68,9 @@ protected void onBindView(@NonNull View view) { Switch switchControl = getSwitch((ViewGroup) view); if (switchControl != null) { switchControl.setThumbTintList(ContextCompat.getColorStateList(this.getContext(), - R.color.primary_400_gray_200_gray_400_selector)); + R.color.primary_40_gray_20_gray_40_selector)); switchControl.setTrackTintList(ContextCompat.getColorStateList(this.getContext(), - R.color.primary_400_gray_900_gray_500_selector)); + R.color.primary_40_gray_90_gray_50_selector)); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java index 9bf4c224cae7..88f8bee3e562 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsFragment.java @@ -715,7 +715,7 @@ private void addPreferencesForPreferenceScreen(PreferenceScreen preferenceScreen ); timelinePreference.setIcon(ColorUtils.INSTANCE.applyTintToDrawable(context, R.drawable.ic_bell_white_24dp, - R.color.neutral_600)); + R.color.neutral_60)); timelinePreference.setTitle(R.string.notifications_tab); timelinePreference.setDialogTitle(R.string.notifications_tab); timelinePreference.setSummary(R.string.notifications_tab_summary); @@ -727,7 +727,7 @@ private void addPreferencesForPreferenceScreen(PreferenceScreen preferenceScreen ); emailPreference.setIcon(ColorUtils.INSTANCE.applyTintToDrawable(context, R.drawable.ic_mail_white_24dp, - R.color.neutral_600)); + R.color.neutral_60)); emailPreference.setTitle(R.string.email); emailPreference.setDialogTitle(R.string.email); emailPreference.setSummary(R.string.notifications_email_summary); @@ -742,7 +742,7 @@ private void addPreferencesForPreferenceScreen(PreferenceScreen preferenceScreen ); devicePreference.setIcon(ColorUtils.INSTANCE.applyTintToDrawable(context, R.drawable.ic_phone_white_24dp, - R.color.neutral_600)); + R.color.neutral_60)); devicePreference.setTitle(R.string.app_notifications); devicePreference.setDialogTitle(R.string.app_notifications); devicePreference.setSummary(R.string.notifications_push_summary); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java index b0b610db70a0..22e933c05af2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java @@ -11,6 +11,7 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.wordpress.android.R; import org.wordpress.android.WordPress; import org.wordpress.android.datasets.PublicizeTable; import org.wordpress.android.models.PublicizeConnection; @@ -18,6 +19,7 @@ import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; import org.wordpress.android.util.AppLog; +import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.JSONUtils; import java.util.HashMap; @@ -36,6 +38,14 @@ public interface OnPublicizeActionListener { void onRequestReconnect(PublicizeService service, PublicizeConnection connection); } + private static class PublicizeConnectionValidationException extends Exception { + private final int mReasonResId; + + PublicizeConnectionValidationException(int reasonResId) { + mReasonResId = reasonResId; + } + } + /* * disconnect a currently connected publicize service */ @@ -114,7 +124,17 @@ private static void connectStepOne(final long siteId, final String serviceId, fi RestRequest.Listener listener = new RestRequest.Listener() { @Override public void onResponse(JSONObject jsonObject) { - if (shouldShowChooserDialog(siteId, serviceId, jsonObject)) { + final boolean showChooserDialog; + try { + showChooserDialog = shouldShowChooserDialog(siteId, serviceId, jsonObject); + } catch (PublicizeConnectionValidationException e) { + final ActionCompleted event = + new ActionCompleted(false, ConnectAction.CONNECT, serviceId, e.mReasonResId); + EventBus.getDefault().post(event); + return; + } + + if (showChooserDialog) { // show dialog showing multiple options EventBus.getDefault() .post(new PublicizeEvents.ActionRequestChooseAccount(siteId, serviceId, jsonObject)); @@ -169,10 +189,11 @@ public void onErrorResponse(VolleyError volleyError) { WordPress.getRestClientUtilsV1_1().post(path, params, null, listener, errorListener); } - private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) { + private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) + throws PublicizeConnectionValidationException { JSONArray jsonConnectionList = jsonObject.optJSONArray("connections"); - if (jsonConnectionList == null || jsonConnectionList.length() <= 1) { + if (jsonConnectionList == null || jsonConnectionList.length() <= 0) { return false; } @@ -191,10 +212,18 @@ private static boolean shouldShowChooserDialog(long siteId, String serviceId, JS } } + final boolean hasExternalAccounts = totalExternalAccounts > 0; if (PublicizeTable.onlyExternalConnections(serviceId)) { - return totalExternalAccounts > 0; + if (!hasExternalAccounts && serviceId.equals(PublicizeService.FACEBOOK_SERVICE_ID)) { + AppLog.i(T.SHARING, + "The Facebook account cannot be linked because either there was no Page selected or the " + + "Page is set as not published."); + throw new PublicizeConnectionValidationException(R.string.sharing_facebook_account_must_have_pages); + } else { + return hasExternalAccounts; + } } else { - return totalAccounts > 0 || totalExternalAccounts > 0; + return totalAccounts > 0 || hasExternalAccounts; } } catch (JSONException e) { return false; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java index d3b9b522dd80..9e0001a62b16 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java @@ -1,5 +1,7 @@ package org.wordpress.android.ui.publicize; +import androidx.annotation.Nullable; + import org.json.JSONObject; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; @@ -17,12 +19,21 @@ public static class ConnectionsChanged { public static class ActionCompleted { private final boolean mSucceeded; private final ConnectAction mAction; + /** + * The reason for why {@link #mSucceeded} is false. + */ + @Nullable private final Integer mReasonResId; private String mService; public ActionCompleted(boolean succeeded, ConnectAction action, String service) { + this(succeeded, action, service, null); + } + + ActionCompleted(boolean succeeded, ConnectAction action, String service, @Nullable Integer reasonResId) { mSucceeded = succeeded; mAction = action; mService = service; + mReasonResId = reasonResId; } public ConnectAction getAction() { @@ -36,6 +47,10 @@ public boolean didSucceed() { public String getService() { return mService; } + + @Nullable public Integer getReasonResId() { + return mReasonResId; + } } public static class ActionAccountChosen { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java index b234a24885ce..0b8cb5c93b08 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java @@ -322,7 +322,11 @@ public void onEventMainThread(PublicizeEvents.ActionCompleted event) { AnalyticsUtils.trackWithSiteDetails(Stat.PUBLICIZE_SERVICE_DISCONNECTED, mSite, analyticsProperties); } } else { - ToastUtils.showToast(this, R.string.error_generic); + if (event.getReasonResId() != null) { + showAlertForFailureReason(event.getReasonResId()); + } else { + ToastUtils.showToast(this, R.string.error_generic); + } } } @@ -372,4 +376,12 @@ public void onButtonPrefsClicked() { .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .commit(); } + + private void showAlertForFailureReason(int reasonResId) { + final AlertDialog.Builder builder = + new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.Calypso_Dialog)); + builder.setMessage(reasonResId); + builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss()); + builder.show(); + } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java index 873998e0f94e..44fe301e2038 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java @@ -708,7 +708,7 @@ public void onShowCustomEmptyView(EmptyViewMessageType emptyViewMsgType) { // the following will change the look and feel of the toolbar to match the current design mRecyclerView.setToolbarBackgroundColor(ContextCompat.getColor(context, R.color.primary)); mRecyclerView.setToolbarSpinnerTextColor(ContextCompat.getColor(context, android.R.color.white)); - mRecyclerView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_blue_light_24dp); + mRecyclerView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_primary_30_24dp); mRecyclerView.setToolbarLeftAndRightPadding( getResources().getDimensionPixelSize(R.dimen.margin_medium), getResources().getDimensionPixelSize(R.dimen.margin_extra_large)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderResourceVars.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderResourceVars.java index d3d59a633154..ec147903bd17 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderResourceVars.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderResourceVars.java @@ -40,7 +40,7 @@ class ReaderResourceVars { mMarginMediumPx = resources.getDimensionPixelSize(R.dimen.margin_medium); mLinkColorStr = HtmlUtils.colorResToHtmlColor(context, R.color.link_reader); - mGreyMediumDarkStr = HtmlUtils.colorResToHtmlColor(context, R.color.neutral_600); + mGreyMediumDarkStr = HtmlUtils.colorResToHtmlColor(context, R.color.neutral_60); mGreyLightStr = HtmlUtils.colorResToHtmlColor(context, R.color.neutral_0); mGreyExtraLightStr = HtmlUtils.colorResToHtmlColor(context, R.color.neutral_0); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderSubsActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderSubsActivity.java index 17cbf2541dd2..30470cad7a86 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderSubsActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderSubsActivity.java @@ -98,7 +98,7 @@ protected void onCreate(Bundle savedInstanceState) { TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); - int normalColor = ContextCompat.getColor(this, R.color.primary_300); + int normalColor = ContextCompat.getColor(this, R.color.primary_30); int selectedColor = ContextCompat.getColor(this, android.R.color.white); tabLayout.setTabTextColors(normalColor, selectedColor); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderCommentAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderCommentAdapter.java index 7e899ca611b6..8d9cd79d105b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderCommentAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderCommentAdapter.java @@ -150,8 +150,8 @@ public ReaderCommentAdapter(Context context, ReaderPost post) { int mediumMargin = context.getResources().getDimensionPixelSize(R.dimen.margin_medium); mContentWidth = displayWidth - (cardMargin * 2) - (contentPadding * 2) - (mediumMargin * 2); - mColorAuthor = ContextCompat.getColor(context, R.color.primary_400); - mColorNotAuthor = ContextCompat.getColor(context, R.color.neutral_700); + mColorAuthor = ContextCompat.getColor(context, R.color.primary_40); + mColorNotAuthor = ContextCompat.getColor(context, R.color.neutral_70); mColorHighlight = ContextCompat.getColor(context, R.color.neutral_0); setHasStableIds(true); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderMenuAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderMenuAdapter.java index fdab1d0fd194..7d18e4b7ac5b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderMenuAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderMenuAdapter.java @@ -78,7 +78,7 @@ public View getView(int position, View convertView, ViewGroup parent) { break; case ITEM_BLOCK: textRes = R.string.reader_menu_block_blog; - colorRes = R.color.neutral_700; + colorRes = R.color.neutral_70; iconRes = R.drawable.ic_block_white_24dp; break; case ITEM_NOTIFICATIONS_OFF: @@ -88,12 +88,12 @@ public View getView(int position, View convertView, ViewGroup parent) { break; case ITEM_NOTIFICATIONS_ON: textRes = R.string.reader_btn_notifications_on; - colorRes = R.color.neutral_800; + colorRes = R.color.neutral_80; iconRes = R.drawable.ic_bell_white_24dp; break; case ITEM_SHARE: textRes = R.string.reader_btn_share; - colorRes = R.color.neutral_700; + colorRes = R.color.neutral_70; iconRes = R.drawable.ic_share_white_24dp; break; default: diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java index 860c67e78e76..91f20f51fe9e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java @@ -253,7 +253,7 @@ public void onClick(View view) { // show author/blog link as disabled if we're previewing a blog, otherwise show // blog preview when the post header is clicked if (getPostListType() == ReaderTypes.ReaderPostListType.BLOG_PREVIEW) { - int color = itemView.getContext().getResources().getColor(R.color.neutral_700); + int color = itemView.getContext().getResources().getColor(R.color.neutral_70); mTxtAuthorAndBlogName.setTextColor(color); // remove the ripple background postHeaderView.setBackground(null); @@ -420,7 +420,7 @@ private void renderRemovedPost(final int position, final ReaderRemovedPostViewHo final Context context = holder.mRemovedPostContainer.getContext(); holder.mTxtRemovedPostTitle.setText(createTextForRemovedPostContainer(post, context)); Drawable drawable = - ColorUtils.INSTANCE.applyTintToDrawable(context, R.drawable.ic_undo_white_24dp, R.color.primary_400); + ColorUtils.INSTANCE.applyTintToDrawable(context, R.drawable.ic_undo_white_24dp, R.color.primary_40); holder.mUndoRemoveAction.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); holder.mCardView.setOnClickListener(new View.OnClickListener() { @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/utils/ReaderUtilsWrapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/utils/ReaderUtilsWrapper.kt new file mode 100644 index 000000000000..64a6c86978e2 --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/utils/ReaderUtilsWrapper.kt @@ -0,0 +1,17 @@ +package org.wordpress.android.ui.reader.utils + +import dagger.Reusable +import javax.inject.Inject + +/** + * Injectable wrapper around ReaderUtils. + * + * ReaderUtils interface is consisted of static methods, which make the client code difficult to test/mock. Main purpose of + * this wrapper is to make testing easier. + * + */ +@Reusable +class ReaderUtilsWrapper @Inject constructor() { + fun getResizedImageUrl(imageUrl: String?, width: Int, height: Int, isPrivate: Boolean): String? = + ReaderUtils.getResizedImageUrl(imageUrl, width, height, isPrivate) +} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderFollowButton.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderFollowButton.java index d5252defbd12..8c17e2772737 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderFollowButton.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderFollowButton.java @@ -77,10 +77,10 @@ private void updateFollowText() { int colorId; if (mIsFollowed) { drawableId = R.drawable.ic_reader_following_white_24dp; - colorId = R.color.success_500; + colorId = R.color.success_50; } else { drawableId = R.drawable.ic_reader_follow_white_24dp; - colorId = R.color.primary_400; + colorId = R.color.primary_40; } ColorUtils.INSTANCE.setImageResourceWithTint(mImageFollow, drawableId, colorId); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderIconCountView.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderIconCountView.java index 40c2a90a9b5b..cf3851c96654 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderIconCountView.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderIconCountView.java @@ -56,13 +56,13 @@ private void initView(Context context, AttributeSet attrs) { mImageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.reader_button_like)); mImageView.setImageTintList(getResources().getColorStateList( - R.color.neutral_accent_neutral_400_selector)); + R.color.neutral_accent_neutral_40_selector)); break; case ICON_COMMENT: mImageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_comment_white_24dp)); mImageView.setImageTintList(getResources().getColorStateList( - R.color.neutral_primary_400_neutral_400_selector)); + R.color.neutral_primary_40_neutral_40_selector)); break; } } finally { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.java index f195cf81d635..3c9c084e3f15 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.java @@ -96,7 +96,7 @@ public void setPost(@NonNull ReaderPost post, boolean isSignedInWPCom) { txtTitle.setOnClickListener(mClickListener); txtSubtitle.setOnClickListener(mClickListener); } else { - int color = getContext().getResources().getColor(R.color.neutral_700); + int color = getContext().getResources().getColor(R.color.neutral_70); txtTitle.setTextColor(color); txtSubtitle.setTextColor(color); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/SiteCreationMainVM.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/SiteCreationMainVM.kt index e5a4d686a932..3803f0b1c59c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/SiteCreationMainVM.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/SiteCreationMainVM.kt @@ -12,6 +12,11 @@ import org.wordpress.android.R import org.wordpress.android.ui.sitecreation.SiteCreationMainVM.SiteCreationScreenTitle.ScreenTitleEmpty import org.wordpress.android.ui.sitecreation.SiteCreationMainVM.SiteCreationScreenTitle.ScreenTitleGeneral import org.wordpress.android.ui.sitecreation.SiteCreationMainVM.SiteCreationScreenTitle.ScreenTitleStepCount +import org.wordpress.android.ui.sitecreation.SiteCreationStep.DOMAINS +import org.wordpress.android.ui.sitecreation.SiteCreationStep.SEGMENTS +import org.wordpress.android.ui.sitecreation.SiteCreationStep.SITE_INFO +import org.wordpress.android.ui.sitecreation.SiteCreationStep.SITE_PREVIEW +import org.wordpress.android.ui.sitecreation.SiteCreationStep.VERTICALS import org.wordpress.android.ui.sitecreation.misc.SiteCreationTracker import org.wordpress.android.ui.sitecreation.previews.SitePreviewViewModel.CreateSiteState import org.wordpress.android.ui.utils.UiString.UiStringRes @@ -51,6 +56,7 @@ class SiteCreationMainVM @Inject constructor( val navigationTargetObservable: SingleEventObservable by lazy { SingleEventObservable( Transformations.map(wizardManager.navigatorLiveData) { + clearOldSiteCreationState(it) WizardNavigationTarget(it, siteCreationState) } ) @@ -114,6 +120,22 @@ class SiteCreationMainVM @Inject constructor( } } + private fun clearOldSiteCreationState(wizardStep: SiteCreationStep) { + when (wizardStep) { + SEGMENTS -> siteCreationState.segmentId?.let { + siteCreationState = siteCreationState.copy(segmentId = null) } + VERTICALS -> siteCreationState.verticalId?.let { + siteCreationState = siteCreationState.copy(verticalId = null) } + SITE_INFO -> { + siteCreationState.siteTitle?.let { siteCreationState = siteCreationState.copy(siteTitle = null) } + siteCreationState.siteTagLine?.let { siteCreationState = siteCreationState.copy(siteTagLine = null) } + } + DOMAINS -> siteCreationState.domain?.let { + siteCreationState = siteCreationState.copy(domain = null) } + SITE_PREVIEW -> {} // intentionally left empty + } + } + fun onVerticalsScreenFinished(verticalId: String) { siteCreationState = siteCreationState.copy(verticalId = verticalId) wizardManager.showNextStep() diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/domains/SiteCreationDomainViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/domains/SiteCreationDomainViewHolder.kt index 9dc304f14d93..10d620246f2b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/domains/SiteCreationDomainViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/domains/SiteCreationDomainViewHolder.kt @@ -26,7 +26,7 @@ sealed class SiteCreationDomainViewHolder(internal val parent: ViewGroup, @Layou init { suggestion.buttonTintList = ContextCompat.getColorStateList( parentView.context, - R.color.neutral_100_primary_400_selector + R.color.neutral_10_primary_40_selector ) container.setOnClickListener { onDomainSelected?.invoke() diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/misc/SearchInputWithHeader.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/misc/SearchInputWithHeader.kt index 1cd02d1441ee..796cdcabc99d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/misc/SearchInputWithHeader.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/misc/SearchInputWithHeader.kt @@ -26,7 +26,7 @@ class SearchInputWithHeader(private val uiHelpers: UiHelpers, rootView: View, on init { val context = rootView.context - val greyColor = ContextCompat.getColor(context, R.color.neutral_300) + val greyColor = ContextCompat.getColor(context, R.color.neutral_30) val inputDrawable = AppCompatResources.getDrawable(context, R.drawable.ic_search_white_24dp) inputDrawable?.setTint(greyColor) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/previews/SiteCreationPreviewFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/previews/SiteCreationPreviewFragment.kt index 173b172981e1..86d37cf53fdd 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/previews/SiteCreationPreviewFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/previews/SiteCreationPreviewFragment.kt @@ -260,13 +260,13 @@ class SiteCreationPreviewFragment : SiteCreationBaseFormFragment(), ): Spannable { val spannableTitle = SpannableString(url) spannableTitle.setSpan( - ForegroundColorSpan(ContextCompat.getColor(context, R.color.neutral_800)), + ForegroundColorSpan(ContextCompat.getColor(context, R.color.neutral_80)), subdomainSpan.first, subdomainSpan.second, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ) spannableTitle.setSpan( - ForegroundColorSpan(ContextCompat.getColor(context, R.color.neutral_500)), + ForegroundColorSpan(ContextCompat.getColor(context, R.color.neutral_50)), domainSpan.first, domainSpan.second, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/services/SiteCreationServiceNotification.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/services/SiteCreationServiceNotification.kt index feef5dd1299c..efae578de59b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/services/SiteCreationServiceNotification.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/services/SiteCreationServiceNotification.kt @@ -7,7 +7,7 @@ import org.wordpress.android.util.AutoForegroundNotification object SiteCreationServiceNotification { private const val channelResId = R.string.notification_channel_normal_id - private const val colorResId = R.color.primary_500 + private const val colorResId = R.color.primary_50 private const val drawableResId = R.drawable.ic_my_sites_white_24dp fun createCreatingSiteNotification(context: Context): Notification { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/verticals/SiteCreationSiteInfoViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/verticals/SiteCreationSiteInfoViewModel.kt index 4acc29806a13..808d7c324272 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/verticals/SiteCreationSiteInfoViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/sitecreation/verticals/SiteCreationSiteInfoViewModel.kt @@ -101,7 +101,7 @@ class SiteCreationSiteInfoViewModel @Inject constructor( ) { SKIP( text = R.string.new_site_creation_button_skip, - textColor = R.color.neutral_800, + textColor = R.color.neutral_80, backgroundColor = android.R.color.white ), NEXT( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/OldStatsActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/OldStatsActivity.java index 730dfd1f919c..dd29235ce13e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/OldStatsActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/OldStatsActivity.java @@ -255,7 +255,7 @@ public void onNothingSelected(AdapterView parent) { }); Toolbar spinnerToolbar = findViewById(R.id.toolbar_filter); - spinnerToolbar.setBackgroundColor(getResources().getColor(R.color.primary_400)); + spinnerToolbar.setBackgroundColor(getResources().getColor(R.color.primary_40)); } selectCurrentTimeframeInActionBar(); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsBarGraph.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsBarGraph.java index f6732aa14680..4b3e69207e2a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsBarGraph.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsBarGraph.java @@ -145,7 +145,7 @@ public int get(int index) { if (mBarPositionToHighlight == index) { return getResources().getColor(R.color.accent); } else { - return getResources().getColor(R.color.neutral_600); + return getResources().getColor(R.color.neutral_60); } } } @@ -153,8 +153,8 @@ public int get(int index) { private void setProperties() { GraphViewStyle gStyle = getGraphViewStyle(); gStyle.setHorizontalLabelsIndexDependentColor(new HorizontalLabelsColor()); - gStyle.setHorizontalLabelsColor(getResources().getColor(R.color.neutral_600)); - gStyle.setVerticalLabelsColor(getResources().getColor(R.color.neutral_400)); + gStyle.setHorizontalLabelsColor(getResources().getColor(R.color.neutral_60)); + gStyle.setVerticalLabelsColor(getResources().getColor(R.color.neutral_40)); gStyle.setTextSize(getResources().getDimensionPixelSize(R.dimen.text_sz_extra_small)); gStyle.setGridXColor(Color.TRANSPARENT); gStyle.setGridYColor(getResources().getColor(R.color.neutral_0)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsLatestPostSummaryFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsLatestPostSummaryFragment.java index 750c2ed2f272..08541c4ecda7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsLatestPostSummaryFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsLatestPostSummaryFragment.java @@ -230,13 +230,13 @@ private void setupTab(LinearLayout currentTab, String total, // Likes and Comments shouldn't link anywhere because they don't have summaries // so their color should be Gray Darken 30 or #3d596d if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.VIEWS) { - value.setTextColor(getResources().getColor(R.color.primary_500)); + value.setTextColor(getResources().getColor(R.color.primary_50)); } else { - value.setTextColor(getResources().getColor(R.color.neutral_600)); + value.setTextColor(getResources().getColor(R.color.neutral_60)); } } icon = currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon); - ColorUtils.INSTANCE.setImageResourceWithTint(icon, getTabIcon(itemType), R.color.neutral_700); + ColorUtils.INSTANCE.setImageResourceWithTint(icon, getTabIcon(itemType), R.color.neutral_70); if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) { currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsTodayFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsTodayFragment.java index 4faf24881565..235b62b6f740 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsTodayFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsInsightsTodayFragment.java @@ -159,10 +159,10 @@ private void setupTab(LinearLayout currentTab, String total, if (total.equals("0")) { value.setTextColor(getResources().getColor(R.color.neutral)); } else { - value.setTextColor(getResources().getColor(R.color.primary_500)); + value.setTextColor(getResources().getColor(R.color.primary_50)); } icon = currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon); - ColorUtils.INSTANCE.setImageResourceWithTint(icon, getTabIcon(itemType), R.color.neutral_700); + ColorUtils.INSTANCE.setImageResourceWithTint(icon, getTabIcon(itemType), R.color.neutral_70); if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) { currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsSingleItemDetailsActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsSingleItemDetailsActivity.java index 886a8abbdfd3..7928c8a13c1a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsSingleItemDetailsActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsSingleItemDetailsActivity.java @@ -233,7 +233,7 @@ public void onClick(View v) { } }); } else { - mStatsForLabel.setTextColor(getResources().getColor(R.color.neutral_500)); + mStatsForLabel.setTextColor(getResources().getColor(R.color.neutral_50)); } } else { mStatsForLabel.setVisibility(View.GONE); @@ -447,7 +447,7 @@ private void updateUI() { mCurrentSeriesOnScreen.getStyle().highlightColor = getResources().getColor(R.color.accent); mCurrentSeriesOnScreen.getStyle().outerhighlightColor = - getResources().getColor(R.color.accent_100); + getResources().getColor(R.color.accent_10); mCurrentSeriesOnScreen.getStyle().padding = DisplayUtils.dpToPx(this, 5); StatsBarGraph mGraphView; @@ -464,7 +464,7 @@ private void updateUI() { mGraphView.addSeries(mCurrentSeriesOnScreen); // mGraphView.getGraphViewStyle().setNumHorizontalLabels(getNumOfHorizontalLabels(dataToShowOnGraph.length)); mGraphView.getGraphViewStyle().setNumHorizontalLabels(dataToShowOnGraph.length); - mGraphView.getGraphViewStyle().setVerticalLabelsColor(getResources().getColor(R.color.neutral_600)); + mGraphView.getGraphViewStyle().setVerticalLabelsColor(getResources().getColor(R.color.neutral_60)); mGraphView.getGraphViewStyle().setMaxColumnWidth( DisplayUtils.dpToPx(this, StatsConstants.STATS_GRAPH_BAR_MAX_COLUMN_WIDTH_DP)); mGraphView.getGraphViewStyle().setTextSize( @@ -598,7 +598,7 @@ public void onClick(View view) { if (currentDay.getCount() == maxReachedValue && maxReachedValue > 0) { holder.imgMore.setVisibility(View.VISIBLE); ColorUtils.INSTANCE.setImageResourceWithTint(holder.imgMore, R.drawable.ic_trophy_white_24dp, - R.color.warning_500); + R.color.warning_50); holder.imgMore.setBackgroundColor(Color.TRANSPARENT); // Hide the default click indicator } else { holder.imgMore.setVisibility(View.GONE); @@ -691,7 +691,7 @@ public View getGroupView(final int groupPosition, boolean isExpanded, if (shouldShowTheTrophyIcon) { holder.imgMore.setVisibility(View.VISIBLE); ColorUtils.INSTANCE.setImageResourceWithTint(holder.imgMore, R.drawable.ic_trophy_white_24dp, - R.color.warning_500); + R.color.warning_50); holder.imgMore.setBackgroundColor(Color.TRANSPARENT); // Hide the default click indicator } else { holder.imgMore.setVisibility(View.GONE); @@ -783,7 +783,7 @@ public void onClick(View view) { if (currentMonth.getCount() == maxReachedValue && maxReachedValue > 0) { holder.imgMore.setVisibility(View.VISIBLE); ColorUtils.INSTANCE.setImageResourceWithTint(holder.imgMore, R.drawable.ic_trophy_white_24dp, - R.color.warning_500); + R.color.warning_50); holder.imgMore.setBackgroundColor(Color.TRANSPARENT); // Hide the default click indicator } else { holder.imgMore.setVisibility(View.GONE); @@ -852,7 +852,7 @@ public View getGroupView(final int groupPosition, boolean isExpanded, if (shouldShowTheTrophyIcon) { holder.imgMore.setVisibility(View.VISIBLE); ColorUtils.INSTANCE.setImageResourceWithTint(holder.imgMore, R.drawable.ic_trophy_white_24dp, - R.color.warning_500); + R.color.warning_50); holder.imgMore.setBackgroundColor(Color.TRANSPARENT); // Hide the default click indicator } else { holder.imgMore.setVisibility(View.GONE); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsUIHelper.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsUIHelper.java index aa671a24d93e..210ce97c22ab 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsUIHelper.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsUIHelper.java @@ -174,7 +174,7 @@ public static void reloadGroupViews(final Context ctx, if (chevron != null) { chevron.clearAnimation(); ColorUtils.INSTANCE.setImageResourceWithTint(chevron, R.drawable.ic_chevron_right_white_24dp, - R.color.primary_500); + R.color.primary_50); } // add children if this group is expanded @@ -283,7 +283,7 @@ private static void setGroupChevron(final boolean isGroupExpanded, View groupVie : R.drawable.ic_chevron_right_white_24dp); } - chevron.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(R.color.primary_500))); + chevron.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(R.color.primary_50))); } private static void showChildViews(ExpandableListAdapter mAdapter, LinearLayout mLinearLayout, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsVisitorsAndViewsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsVisitorsAndViewsFragment.java index 10335ae2e605..183b20cb77b7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsVisitorsAndViewsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsVisitorsAndViewsFragment.java @@ -192,11 +192,11 @@ public void updateBackGroundAndIcon(int currentValue) { if (currentValue == 0) { mValue.setTextColor(getResources().getColor(R.color.neutral)); } else { - mValue.setTextColor(getResources().getColor(R.color.primary_500)); + mValue.setTextColor(getResources().getColor(R.color.primary_50)); } } - ColorUtils.INSTANCE.setImageResourceWithTint(mIcon, getTabIcon(), R.color.neutral_700); + ColorUtils.INSTANCE.setImageResourceWithTint(mIcon, getTabIcon(), R.color.neutral_70); if (mIsLastItem) { if (mIsChecked) { @@ -457,7 +457,7 @@ protected void updateUI() { mainSeriesOnScreen.getStyle().highlightColor = getResources().getColor(R.color.accent); mainSeriesOnScreen.getStyle().outerhighlightColor = - getResources().getColor(R.color.accent_100); + getResources().getColor(R.color.accent_10); mainSeriesOnScreen.getStyle().padding = DisplayUtils.dpToPx(getActivity(), 5); mGraphView.addSeries(mainSeriesOnScreen); @@ -466,7 +466,7 @@ protected void updateUI() { GraphViewSeries secondarySeries = new GraphViewSeries(secondarySeriesItems); secondarySeries.getStyle().padding = DisplayUtils.dpToPx(getActivity(), 10); secondarySeries.getStyle().color = getResources().getColor(R.color.primary_dark); - secondarySeries.getStyle().highlightColor = getResources().getColor(R.color.accent_600); + secondarySeries.getStyle().highlightColor = getResources().getColor(R.color.accent_60); mGraphView.addSeries(secondarySeries); } @@ -490,7 +490,7 @@ protected void updateUI() { DisplayUtils.dpToPx(getActivity(), StatsConstants.STATS_GRAPH_BAR_MAX_COLUMN_WIDTH_DP)); mGraphView.getGraphViewStyle().setTextSize( getResources().getDimensionPixelOffset(R.dimen.stats_legent_text_size)); - mGraphView.getGraphViewStyle().setVerticalLabelsColor(getResources().getColor(R.color.neutral_600)); + mGraphView.getGraphViewStyle().setVerticalLabelsColor(getResources().getColor(R.color.neutral_60)); mGraphView.setHorizontalLabels(horLabels); mGraphView.setAccessibleHorizontalLabels(makeAccessibleHorizontalLabels(horLabels, mainSeriesItems, selectedStatsType)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetConfigureAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetConfigureAdapter.java index 4bcd039f9314..10a361766553 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetConfigureAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetConfigureAdapter.java @@ -92,11 +92,11 @@ public StatsWidgetConfigureAdapter(Context context, long primarySiteId) { mInflater = LayoutInflater.from(context); mBlavatarSz = context.getResources().getDimensionPixelSize(R.dimen.blavatar_sz); - mTextColorNormal = context.getResources().getColor(R.color.neutral_700); - mTextColorHidden = context.getResources().getColor(R.color.neutral_300); + mTextColorNormal = context.getResources().getColor(R.color.neutral_70); + mTextColorHidden = context.getResources().getColor(R.color.neutral_30); mSelectedItemBackground = - new ColorDrawable(context.getResources().getColor(R.color.gray_50)); + new ColorDrawable(context.getResources().getColor(R.color.gray_5)); loadSites(); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetProvider.java b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetProvider.java index 4f51fb05c652..7011109113a8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetProvider.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsWidgetProvider.java @@ -95,7 +95,7 @@ private static void updateTabValue(Context context, RemoteViews remoteViews, int } remoteViews.setTextViewText(viewId, FormatUtils.formatDecimal(value)); if (text.equals("0")) { - remoteViews.setTextColor(viewId, context.getResources().getColor(R.color.neutral_300)); + remoteViews.setTextColor(viewId, context.getResources().getColor(R.color.neutral_30)); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt index b5f30e3c4ca2..e4e268d8f844 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt @@ -101,7 +101,8 @@ class BlockDiffCallback( TAB_CHANGED newItem is Columns && oldItem is Columns && oldItem.selectedColumn != newItem.selectedColumn -> return SELECTED_COLUMN_CHANGED - newItem is Columns && oldItem is Columns && oldItem.values != newItem.values -> return COLUMNS_VALUE_CHANGED + newItem is Columns && oldItem is Columns && oldItem.columns != newItem.columns -> + return COLUMNS_VALUE_CHANGED newItem is BarChartItem && oldItem is BarChartItem && oldItem.selectedItem != newItem.selectedItem -> return SELECTED_BAR_CHANGED else -> null diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostAverageViewsPerDayUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostAverageViewsPerDayUseCase.kt index 3e8dfea5f999..60c748134d3f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostAverageViewsPerDayUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostAverageViewsPerDayUseCase.kt @@ -67,14 +67,20 @@ class PostAverageViewsPerDayUseCase( if (useCaseMode == BLOCK) { items.add(Title(R.string.stats_detail_average_views_per_day)) } + val header = Header( + R.string.stats_months_and_years_period_label, + R.string.stats_months_and_years_views_label + ) items.add( - Header( - R.string.stats_months_and_years_period_label, - R.string.stats_months_and_years_views_label - ) + header ) val shownYears = domainModel.yearsAverage.sortedByDescending { it.year }.takeLast(itemsToLoad) - val yearList = postDetailMapper.mapYears(shownYears, uiState, this::onUiState) + val yearList = postDetailMapper.mapYears( + shownYears, + uiState, + header, + this::onUiState + ) items.addAll(yearList) if (useCaseMode == BLOCK && domainModel.yearsAverage.size > itemsToLoad) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsMapper.kt index 60c0e57b0279..fd241ac5ccae 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsMapper.kt @@ -27,19 +27,8 @@ class PostDayViewsMapper val value = selectedItem.count val previousValue = previousItem?.count val positive = value >= (previousValue ?: 0) - val change = previousValue?.let { - val difference = value - previousValue - val percentage = when (previousValue) { - value -> "0" - 0 -> "∞" - else -> (difference * 100 / previousValue).toFormattedString() - } - if (positive) { - resourceProvider.getString(R.string.stats_traffic_increase, difference.toFormattedString(), percentage) - } else { - resourceProvider.getString(R.string.stats_traffic_change, difference.toFormattedString(), percentage) - } - } + val change = buildChange(previousValue, value, positive, isFormattedNumber = true) + val unformattedChange = buildChange(previousValue, value, positive, isFormattedNumber = false) val state = when { isLast -> State.NEUTRAL @@ -51,10 +40,46 @@ class PostDayViewsMapper unit = R.string.stats_views, isFirst = true, change = change, - state = state + state = state, + contentDescription = resourceProvider.getString( + R.string.stats_overview_content_description, + value, + resourceProvider.getString(R.string.stats_views), + statsDateFormatter.printDate(selectedItem.period), + unformattedChange ?: "" + ) ) } + private fun buildChange( + previousValue: Int?, + value: Int, + positive: Boolean, + isFormattedNumber: Boolean + ): String? { + return previousValue?.let { + val difference = value - previousValue + val percentage = when (previousValue) { + value -> "0" + 0 -> "∞" + else -> mapIntToString((difference * 100 / previousValue), isFormattedNumber) + } + val formattedDifference = mapIntToString(difference, isFormattedNumber) + if (positive) { + resourceProvider.getString(R.string.stats_traffic_increase, formattedDifference, percentage) + } else { + resourceProvider.getString(R.string.stats_traffic_change, formattedDifference, percentage) + } + } + } + + private fun mapIntToString(value: Int, isFormattedNumber: Boolean): String { + return when (isFormattedNumber) { + true -> value.toFormattedString() + false -> value.toString() + } + } + fun buildChart( dayViews: List, selectedDay: String?, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsUseCase.kt index f0aa58d815e1..ebf8beee537a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsUseCase.kt @@ -17,6 +17,7 @@ import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter import org.wordpress.android.ui.stats.refresh.utils.StatsPostProvider import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString +import org.wordpress.android.viewmodel.ResourceProvider import javax.inject.Inject import javax.inject.Named @@ -28,7 +29,8 @@ class PostDayViewsUseCase private val selectedDateProvider: SelectedDateProvider, private val statsSiteProvider: StatsSiteProvider, private val statsPostProvider: StatsPostProvider, - private val postDetailStore: PostDetailStore + private val postDetailStore: PostDetailStore, + private val resourceProvider: ResourceProvider ) : BaseStatsUseCase( PostDetailType.POST_OVERVIEW, mainDispatcher, @@ -106,7 +108,14 @@ class PostDayViewsUseCase } override fun buildLoadingItem(): List { - return listOf(ValueItem(value = 0.toFormattedString(), unit = R.string.stats_views, isFirst = true)) + return listOf( + ValueItem( + value = 0.toFormattedString(), + unit = R.string.stats_views, + isFirst = true, + contentDescription = resourceProvider.getString(R.string.stats_loading_card) + ) + ) } private fun onBarSelected(period: String?) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDetailMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDetailMapper.kt index 08a7fb9400da..ca570b3ef061 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDetailMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDetailMapper.kt @@ -6,8 +6,10 @@ import org.wordpress.android.fluxc.network.utils.StatsGranularity.DAYS import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Divider import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ExpandableItem +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Header import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon.TextStyle.LIGHT +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.util.LocaleManagerWrapper @@ -18,11 +20,13 @@ import javax.inject.Inject class PostDetailMapper @Inject constructor( private val localeManagerWrapper: LocaleManagerWrapper, - private val statsDateFormatter: StatsDateFormatter + private val statsDateFormatter: StatsDateFormatter, + private val contentDescriptionHelper: ContentDescriptionHelper ) { fun mapYears( shownYears: List, expandedYearUiState: ExpandedYearUiState, + header: Header, onUiState: (ExpandedYearUiState) -> Unit ): List { val yearList = mutableListOf() @@ -36,25 +40,32 @@ class PostDetailMapper } yearList.add( ExpandableItem( - mapYear(year, index, shownYears.size, isNextNotExpanded), isExpanded = isExpanded + mapYear(year, index, shownYears.size, isNextNotExpanded, header), + isExpanded = isExpanded ) { changedExpandedState -> val expandedYear = if (changedExpandedState) year.year else null onUiState(expandedYearUiState.copy(expandedYear = expandedYear)) }) if (isExpanded) { yearList.addAll(year.months.sortedByDescending { it.month }.map { month -> + val text = DateFormatSymbols(localeManagerWrapper.getLocale()).shortMonths[month.month - 1] ListItemWithIcon( - text = DateFormatSymbols(localeManagerWrapper.getLocale()).shortMonths[month.month - 1], + text = text, value = month.count.toFormattedString(locale = localeManagerWrapper.getLocale()), textStyle = LIGHT, - showDivider = false + showDivider = false, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + text, + month.count + ) ) }) yearList.add(Divider) } } else { yearList.add( - mapYear(year, index, shownYears.size, isNextNotExpanded) + mapYear(year, index, shownYears.size, isNextNotExpanded, header) ) } } @@ -65,12 +76,19 @@ class PostDetailMapper year: Year, index: Int, size: Int, - isNextNotExpanded: Boolean + isNextNotExpanded: Boolean, + header: Header ): ListItemWithIcon { + val text = year.year.toString() return ListItemWithIcon( - text = year.year.toString(), + text = text, value = year.value.toFormattedString(locale = localeManagerWrapper.getLocale()), - showDivider = isNextNotExpanded && index < size - 1 + showDivider = isNextNotExpanded && index < size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + text, + year.value + ) ) } @@ -78,6 +96,7 @@ class PostDetailMapper weeks: List, visibleCount: Int, uiState: ExpandedWeekUiState, + header: Header, onUiState: (ExpandedWeekUiState) -> Unit ): List { val weekList = mutableListOf() @@ -97,7 +116,8 @@ class PostDetailMapper } weekList.add( ExpandableItem( - mapWeek(week, index, visibleWeeks.size, isNextNotExpanded), isExpanded = isExpanded + mapWeek(week, index, visibleWeeks.size, isNextNotExpanded, header), + isExpanded = isExpanded ) { changedExpandedState -> val expandedFirstDay = if (changedExpandedState) week.firstDay else null onUiState(uiState.copy(expandedWeekFirstDay = expandedFirstDay)) @@ -105,18 +125,24 @@ class PostDetailMapper if (isExpanded) { weekList.addAll(week.days .map { day -> + val text = statsDateFormatter.printDayWithoutYear(day.date) val value = day.average.toFormattedString(locale = localeManagerWrapper.getLocale()) ListItemWithIcon( - text = statsDateFormatter.printDayWithoutYear(day.date), + text = text, value = value, textStyle = LIGHT, - showDivider = false + showDivider = false, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + text, + day.average + ) ) }) weekList.add(Divider) } } else { - weekList.add(mapWeek(week, index, visibleWeeks.size, isNextNotExpanded)) + weekList.add(mapWeek(week, index, visibleWeeks.size, isNextNotExpanded, header)) } } return weekList @@ -131,7 +157,13 @@ class PostDetailMapper val weekAverage: Int ) - private fun mapWeek(week: WeekUiModel, index: Int, size: Int, isNextNotExpanded: Boolean): ListItemWithIcon { + private fun mapWeek( + week: WeekUiModel, + index: Int, + size: Int, + isNextNotExpanded: Boolean, + header: Header + ): ListItemWithIcon { val lastDay = week.lastDay val label = if (lastDay != null) { statsDateFormatter.printWeek(week.firstDay, lastDay) @@ -141,7 +173,12 @@ class PostDetailMapper return ListItemWithIcon( text = label, value = week.weekAverage.toFormattedString(locale = localeManagerWrapper.getLocale()), - showDivider = isNextNotExpanded && index < size - 1 + showDivider = isNextNotExpanded && index < size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + label, + week.weekAverage + ) ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostMonthsAndYearsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostMonthsAndYearsUseCase.kt index 815ba039ae25..552a6a0834af 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostMonthsAndYearsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostMonthsAndYearsUseCase.kt @@ -67,14 +67,20 @@ class PostMonthsAndYearsUseCase( if (useCaseMode == BLOCK) { items.add(Title(R.string.stats_detail_months_and_years)) } + val header = Header( + R.string.stats_months_and_years_period_label, + R.string.stats_months_and_years_views_label + ) items.add( - Header( - R.string.stats_months_and_years_period_label, - R.string.stats_months_and_years_views_label - ) + header ) val shownYears = domainModel.yearsTotal.sortedByDescending { it.year }.takeLast(itemsToLoad) - val yearList = postDetailMapper.mapYears(shownYears, uiState, this::onUiState) + val yearList = postDetailMapper.mapYears( + shownYears, + uiState, + header, + this::onUiState + ) items.addAll(yearList) if (useCaseMode == BLOCK && domainModel.yearsTotal.size > itemsToLoad) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostRecentWeeksUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostRecentWeeksUseCase.kt index 672348af433e..ce40e92e9825 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostRecentWeeksUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostRecentWeeksUseCase.kt @@ -67,13 +67,20 @@ class PostRecentWeeksUseCase( if (useCaseMode == BLOCK) { items.add(Title(R.string.stats_detail_recent_weeks)) } + val header = Header( + R.string.stats_months_and_years_period_label, + R.string.stats_months_and_years_views_label + ) items.add( - Header( - R.string.stats_months_and_years_period_label, - R.string.stats_months_and_years_views_label - ) + header + ) + val yearList = postDetailMapper.mapWeeks( + domainModel.weekViews, + itemsToLoad, + uiState, + header, + this::onUiState ) - val yearList = postDetailMapper.mapWeeks(domainModel.weekViews, itemsToLoad, uiState, this::onUiState) items.addAll(yearList) if (useCaseMode == BLOCK && domainModel.weekViews.size > itemsToLoad) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt index d10f18a9733b..d59015de55ae 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt @@ -97,7 +97,8 @@ sealed class BlockListItem(val type: Type) { @StringRes val unit: Int, val isFirst: Boolean = false, val change: String? = null, - val state: State = POSITIVE + val state: State = POSITIVE, + val contentDescription: String ) : BlockListItem(VALUE_ITEM) { enum class State { POSITIVE, NEGATIVE, NEUTRAL } } @@ -105,7 +106,8 @@ sealed class BlockListItem(val type: Type) { data class ListItem( val text: String, val value: String, - val showDivider: Boolean = true + val showDivider: Boolean = true, + val contentDescription: String ) : BlockListItem(LIST_ITEM) { override val itemId: Int get() = text.hashCode() @@ -122,7 +124,8 @@ sealed class BlockListItem(val type: Type) { val barWidth: Int? = null, val showDivider: Boolean = true, val textStyle: TextStyle = TextStyle.NORMAL, - val navigationAction: NavigationAction? = null + val navigationAction: NavigationAction? = null, + val contentDescription: String ) : BlockListItem(LIST_ITEM_WITH_ICON) { override val itemId: Int get() = (icon ?: 0) + (iconUrl?.hashCode() ?: 0) + (textResource ?: 0) + (text?.hashCode() ?: 0) @@ -157,13 +160,14 @@ sealed class BlockListItem(val type: Type) { } data class Columns( - val headers: List, - val values: List, + val columns: List, val selectedColumn: Int? = null, val onColumnSelected: ((position: Int) -> Unit)? = null ) : BlockListItem(COLUMNS) { override val itemId: Int - get() = headers.hashCode() + get() = columns.hashCode() + + data class Column(val header: Int, val value: String, val contentDescription: String) } data class Link( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/AuthorsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/AuthorsUseCase.kt index 6eae1c65942c..2a1dc7bc2aca 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/AuthorsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/AuthorsUseCase.kt @@ -32,6 +32,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularSt import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider import org.wordpress.android.ui.stats.refresh.lists.sections.granular.usecases.AuthorsUseCase.SelectedAuthor +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.getBarWidth import org.wordpress.android.ui.stats.refresh.utils.toFormattedString @@ -52,6 +53,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatefulUseCase( AUTHORS, @@ -102,7 +104,8 @@ constructor( if (domainModel.authors.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_author_label, R.string.stats_author_views_label)) + val header = Header(R.string.stats_author_label, R.string.stats_author_views_label) + items.add(header) val maxViews = domainModel.authors.maxBy { it.views }?.views ?: 0 domainModel.authors.forEachIndexed { index, author -> val headerItem = ListItemWithIcon( @@ -111,7 +114,12 @@ constructor( text = author.name, barWidth = getBarWidth(author.views, maxViews), value = author.views.toFormattedString(), - showDivider = index < domainModel.authors.size - 1 + showDivider = index < domainModel.authors.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + author.name, + author.views + ) ) if (author.posts.isEmpty()) { items.add(headerItem) @@ -131,6 +139,12 @@ constructor( navigationAction = create( PostClickParams(post.id, post.url, post.title), this::onPostClicked + ), + contentDescription = contentDescriptionHelper.buildContentDescription( + R.string.stats_post_label, + post.title, + R.string.stats_post_views_label, + post.views ) ) }) @@ -187,7 +201,8 @@ constructor( private val authorsStore: AuthorsStore, private val statsSiteProvider: StatsSiteProvider, private val selectedDateProvider: SelectedDateProvider, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = AuthorsUseCase( @@ -197,6 +212,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ClicksUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ClicksUseCase.kt index 78e6c0e7516d..f4a41c4145ac 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ClicksUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ClicksUseCase.kt @@ -22,13 +22,13 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Heade import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Link import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon.TextStyle.LIGHT -import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.NavigationAction import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.NavigationAction.Companion.create import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularStatefulUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider import org.wordpress.android.ui.stats.refresh.lists.sections.granular.usecases.ClicksUseCase.SelectedClicksGroup +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.ui.stats.refresh.utils.trackGranular @@ -48,6 +48,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatefulUseCase( CLICKS, @@ -98,13 +99,21 @@ constructor( if (domainModel.groups.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_clicks_link_label, R.string.stats_clicks_label)) + val header = Header(R.string.stats_clicks_link_label, R.string.stats_clicks_label) + items.add(header) domainModel.groups.forEachIndexed { index, group -> + val groupName = group.name + val contentDescription = contentDescriptionHelper.buildContentDescription( + header, + groupName ?: "", + group.views ?: 0 + ) val headerItem = ListItemWithIcon( - text = group.name, + text = groupName, value = group.views?.toFormattedString(), showDivider = index < domainModel.groups.size - 1, - navigationAction = group.url?.let { NavigationAction.create(it, this::onItemClick) } + navigationAction = group.url?.let { create(it, this::onItemClick) }, + contentDescription = contentDescription ) if (group.clicks.isEmpty()) { items.add(headerItem) @@ -120,7 +129,12 @@ constructor( textStyle = LIGHT, value = click.views.toFormattedString(), showDivider = false, - navigationAction = click.url?.let { create(it, this::onItemClick) } + navigationAction = click.url?.let { create(it, this::onItemClick) }, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + click.name, + click.views + ) ) }) items.add(Divider) @@ -163,6 +177,7 @@ constructor( private val store: ClicksStore, private val statsSiteProvider: StatsSiteProvider, private val selectedDateProvider: SelectedDateProvider, + private val contentDescriptionHelper: ContentDescriptionHelper, private val analyticsTracker: AnalyticsTrackerWrapper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = @@ -173,6 +188,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/CountryViewsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/CountryViewsUseCase.kt index 839fa8efb313..e2d33ec2766a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/CountryViewsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/CountryViewsUseCase.kt @@ -25,6 +25,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularStatelessUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.ui.stats.refresh.utils.trackGranular @@ -44,6 +45,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatelessUseCase( COUNTRIES, @@ -117,14 +119,20 @@ constructor( val endLabel = (maxViews ?: 0).toFormattedString() items.add(MapItem(stringBuilder.toString(), R.string.stats_country_views_label)) items.add(MapLegend(startLabel, endLabel)) - items.add(Header(R.string.stats_country_label, R.string.stats_country_views_label)) + val header = Header(R.string.stats_country_label, R.string.stats_country_views_label) + items.add(header) domainModel.countries.forEachIndexed { index, group -> items.add( ListItemWithIcon( iconUrl = group.flagIconUrl, text = group.fullName, value = group.views.toFormattedString(), - showDivider = index < domainModel.countries.size - 1 + showDivider = index < domainModel.countries.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + group.fullName, + group.views + ) ) ) } @@ -157,7 +165,8 @@ constructor( private val store: CountryViewsStore, private val statsSiteProvider: StatsSiteProvider, private val selectedDateProvider: SelectedDateProvider, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = CountryViewsUseCase( @@ -167,6 +176,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewMapper.kt index a9e6e7b2e02b..b188693e49cf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewMapper.kt @@ -3,13 +3,16 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.granular.usecases import org.wordpress.android.R import org.wordpress.android.fluxc.model.stats.time.VisitsAndViewsModel.PeriodData import org.wordpress.android.fluxc.network.utils.StatsGranularity +import org.wordpress.android.fluxc.network.utils.StatsGranularity.DAYS import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.BarChartItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.BarChartItem.Bar import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ChartLegend import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Columns +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Columns.Column import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ValueItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ValueItem.State +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.MILLION import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter import org.wordpress.android.ui.stats.refresh.utils.toFormattedString @@ -19,7 +22,8 @@ import javax.inject.Inject class OverviewMapper @Inject constructor( private val statsDateFormatter: StatsDateFormatter, - private val resourceProvider: ResourceProvider + private val resourceProvider: ResourceProvider, + private val contentDescriptionHelper: ContentDescriptionHelper ) { private val units = listOf( R.string.stats_views, @@ -29,28 +33,18 @@ class OverviewMapper ) fun buildTitle( - selectedItem: PeriodData?, + selectedItem: PeriodData, previousItem: PeriodData?, selectedPosition: Int, isLast: Boolean, - startValue: Int = MILLION + startValue: Int = MILLION, + statsGranularity: StatsGranularity = DAYS ): ValueItem { - val value = selectedItem?.getValue(selectedPosition) ?: 0 + val value = selectedItem.getValue(selectedPosition) ?: 0 val previousValue = previousItem?.getValue(selectedPosition) val positive = value >= (previousValue ?: 0) - val change = previousValue?.let { - val difference = value - previousValue - val percentage = when (previousValue) { - value -> "0" - 0L -> "∞" - else -> (difference * 100 / previousValue).toFormattedString() - } - if (positive) { - resourceProvider.getString(R.string.stats_traffic_increase, difference.toFormattedString(), percentage) - } else { - resourceProvider.getString(R.string.stats_traffic_change, difference.toFormattedString(), percentage) - } - } + val change = buildChange(previousValue, value, positive, isFormattedNumber = true) + val unformattedChange = buildChange(previousValue, value, positive, isFormattedNumber = false) val state = when { isLast -> State.NEUTRAL positive -> State.POSITIVE @@ -61,10 +55,46 @@ class OverviewMapper unit = units[selectedPosition], isFirst = true, change = change, - state = state + state = state, + contentDescription = resourceProvider.getString( + R.string.stats_overview_content_description, + value, + resourceProvider.getString(units[selectedPosition]), + statsDateFormatter.printGranularDate(selectedItem.period, statsGranularity), + unformattedChange ?: "" + ) ) } + private fun buildChange( + previousValue: Long?, + value: Long, + positive: Boolean, + isFormattedNumber: Boolean + ): String? { + return previousValue?.let { + val difference = value - previousValue + val percentage = when (previousValue) { + value -> "0" + 0L -> "∞" + else -> mapLongToString((difference * 100 / previousValue), isFormattedNumber) + } + val formattedDifference = mapLongToString(difference, isFormattedNumber) + if (positive) { + resourceProvider.getString(R.string.stats_traffic_increase, formattedDifference, percentage) + } else { + resourceProvider.getString(R.string.stats_traffic_change, formattedDifference, percentage) + } + } + } + + private fun mapLongToString(value: Long, isFormattedNumber: Boolean): String { + return when (isFormattedNumber) { + true -> value.toFormattedString() + false -> value.toString() + } + } + private fun PeriodData.getValue( selectedPosition: Int ): Long? { @@ -82,13 +112,44 @@ class OverviewMapper onColumnSelected: (position: Int) -> Unit, selectedPosition: Int ): Columns { + val views = selectedItem?.views ?: 0 + val visitors = selectedItem?.visitors ?: 0 + val likes = selectedItem?.likes ?: 0 + val comments = selectedItem?.comments ?: 0 return Columns( - units, listOf( - selectedItem?.views?.toFormattedString() ?: "0", - selectedItem?.visitors?.toFormattedString() ?: "0", - selectedItem?.likes?.toFormattedString() ?: "0", - selectedItem?.comments?.toFormattedString() ?: "0" + Column( + R.string.stats_views, + views.toFormattedString(), + contentDescriptionHelper.buildContentDescription( + R.string.stats_views, + views + ) + ), + Column( + R.string.stats_visitors, + visitors.toFormattedString(), + contentDescriptionHelper.buildContentDescription( + R.string.stats_visitors, + visitors + ) + ), + Column( + R.string.stats_likes, + likes.toFormattedString(), + contentDescriptionHelper.buildContentDescription( + R.string.stats_likes, + likes + ) + ), + Column( + R.string.stats_comments, + comments.toFormattedString(), + contentDescriptionHelper.buildContentDescription( + R.string.stats_comments, + comments + ) + ) ), selectedPosition, onColumnSelected @@ -134,13 +195,15 @@ class OverviewMapper if (shouldShowVisitors) { result.add(ChartLegend(R.string.stats_visitors)) } - result.add(BarChartItem( - chartItems, - overlappingEntries = overlappingItems, - selectedItem = selectedItemPeriod, - onBarSelected = onBarSelected, - onBarChartDrawn = onBarChartDrawn - )) + result.add( + BarChartItem( + chartItems, + overlappingEntries = overlappingItems, + selectedItem = selectedItemPeriod, + onBarSelected = onBarSelected, + onBarChartDrawn = onBarChartDrawn + ) + ) return result } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt index 071821f81221..dc78dca2996c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt @@ -22,6 +22,7 @@ import org.wordpress.android.ui.stats.refresh.utils.trackGranular import org.wordpress.android.util.AppLog import org.wordpress.android.util.AppLog.T import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper +import org.wordpress.android.viewmodel.ResourceProvider import javax.inject.Inject import javax.inject.Named @@ -36,7 +37,8 @@ constructor( private val statsDateFormatter: StatsDateFormatter, private val overviewMapper: OverviewMapper, @Named(UI_THREAD) private val mainDispatcher: CoroutineDispatcher, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val resourceProvider: ResourceProvider ) : BaseStatsUseCase( OVERVIEW, mainDispatcher, @@ -50,7 +52,12 @@ constructor( override fun buildLoadingItem(): List = listOf( - ValueItem(value = 0.toFormattedString(), unit = R.string.stats_views, isFirst = true) + ValueItem( + value = 0.toFormattedString(), + unit = R.string.stats_views, + isFirst = true, + contentDescription = resourceProvider.getString(R.string.stats_loading_card) + ) ) override suspend fun loadCachedData(): VisitsAndViewsModel? { @@ -115,7 +122,8 @@ constructor( selectedItem, previousItem, uiState.selectedPosition, - isLast = selectedItem == domainModel.dates.last() + isLast = selectedItem == domainModel.dates.last(), + statsGranularity = statsGranularity ) ) items.addAll( @@ -166,7 +174,8 @@ constructor( private val statsDateFormatter: StatsDateFormatter, private val overviewMapper: OverviewMapper, private val visitsAndViewsStore: VisitsAndViewsStore, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val resourceProvider: ResourceProvider ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = OverviewUseCase( @@ -177,7 +186,8 @@ constructor( statsDateFormatter, overviewMapper, mainDispatcher, - analyticsTracker + analyticsTracker, + resourceProvider ) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/PostsAndPagesUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/PostsAndPagesUseCase.kt index e9c0dd5ca7e9..baeed5843ae5 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/PostsAndPagesUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/PostsAndPagesUseCase.kt @@ -29,6 +29,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularStatelessUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.getBarWidth import org.wordpress.android.ui.stats.refresh.utils.toFormattedString @@ -49,6 +50,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatelessUseCase( POSTS_AND_PAGES, @@ -102,7 +104,8 @@ constructor( if (domainModel.views.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_posts_and_pages_title_label, R.string.stats_posts_and_pages_views_label)) + val header = Header(R.string.stats_posts_and_pages_title_label, R.string.stats_posts_and_pages_views_label) + items.add(header) val maxViews = domainModel.views.maxBy { it.views }?.views ?: 0 items.addAll(domainModel.views.mapIndexed { index, viewsModel -> val icon = when (viewsModel.type) { @@ -118,6 +121,11 @@ constructor( navigationAction = create( LinkClickParams(viewsModel.id, viewsModel.url, viewsModel.title, viewsModel.type), this::onLinkClicked + ), + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + viewsModel.title, + viewsModel.views ) ) }) @@ -172,6 +180,7 @@ constructor( private val postsAndPageViewsStore: PostAndPageViewsStore, private val selectedDateProvider: SelectedDateProvider, private val statsSiteProvider: StatsSiteProvider, + private val contentDescriptionHelper: ContentDescriptionHelper, private val analyticsTracker: AnalyticsTrackerWrapper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = @@ -182,6 +191,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ReferrersUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ReferrersUseCase.kt index 52269602d0fd..22ad5227e5b2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ReferrersUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/ReferrersUseCase.kt @@ -30,6 +30,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularSt import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider import org.wordpress.android.ui.stats.refresh.lists.sections.granular.usecases.ReferrersUseCase.SelectedGroup +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.ui.stats.refresh.utils.trackGranular @@ -49,6 +50,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatefulUseCase( REFERRERS, @@ -99,9 +101,16 @@ constructor( if (domainModel.groups.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_referrer_label, R.string.stats_referrer_views_label)) + val header = Header(R.string.stats_referrer_label, R.string.stats_referrer_views_label) + items.add(header) domainModel.groups.forEachIndexed { index, group -> val icon = buildIcon(group.icon) + val contentDescription = + contentDescriptionHelper.buildContentDescription( + header, + group.name ?: "", + group.total ?: 0 + ) if (group.referrers.isEmpty()) { val headerItem = ListItemWithIcon( icon = icon, @@ -109,7 +118,8 @@ constructor( text = group.name, value = group.total?.toFormattedString(), showDivider = index < domainModel.groups.size - 1, - navigationAction = group.url?.let { create(it, this::onItemClick) } + navigationAction = group.url?.let { create(it, this::onItemClick) }, + contentDescription = contentDescription ) items.add(headerItem) } else { @@ -118,7 +128,8 @@ constructor( iconUrl = if (icon == null) group.icon else null, text = group.name, value = group.total?.toFormattedString(), - showDivider = index < domainModel.groups.size - 1 + showDivider = index < domainModel.groups.size - 1, + contentDescription = contentDescription ) val isExpanded = group.groupId == uiState.groupId items.add(ExpandableItem(headerItem, isExpanded) { changedExpandedState -> @@ -140,7 +151,12 @@ constructor( text = referrer.name, value = referrer.views.toFormattedString(), showDivider = false, - navigationAction = referrer.url?.let { create(it, this::onItemClick) } + navigationAction = referrer.url?.let { create(it, this::onItemClick) }, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + referrer.name, + referrer.views + ) ) }) items.add(Divider) @@ -191,6 +207,7 @@ constructor( private val referrersStore: ReferrersStore, private val statsSiteProvider: StatsSiteProvider, private val selectedDateProvider: SelectedDateProvider, + private val contentDescriptionHelper: ContentDescriptionHelper, private val analyticsTracker: AnalyticsTrackerWrapper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = @@ -201,6 +218,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/SearchTermsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/SearchTermsUseCase.kt index f3f3a91c1693..dfb0a3f65891 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/SearchTermsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/SearchTermsUseCase.kt @@ -23,6 +23,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularStatelessUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.ui.stats.refresh.utils.trackGranular @@ -42,6 +43,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatelessUseCase( SEARCH_TERMS, @@ -95,13 +97,19 @@ constructor( if (domainModel.searchTerms.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_search_terms_label, R.string.stats_search_terms_views_label)) + val header = Header(R.string.stats_search_terms_label, R.string.stats_search_terms_views_label) + items.add(header) val hasEncryptedCount = domainModel.unknownSearchCount > 0 val mappedSearchTerms = domainModel.searchTerms.mapIndexed { index, searchTerm -> ListItemWithIcon( text = searchTerm.text, value = searchTerm.views.toFormattedString(), - showDivider = index < domainModel.searchTerms.size - 1 + showDivider = index < domainModel.searchTerms.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + searchTerm.text, + searchTerm.views + ) ) } if (hasEncryptedCount) { @@ -110,7 +118,12 @@ constructor( ListItemWithIcon( textResource = R.string.stats_search_terms_unknown_search_terms, value = domainModel.unknownSearchCount.toFormattedString(), - showDivider = false + showDivider = false, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + R.string.stats_search_terms_unknown_search_terms, + domainModel.unknownSearchCount + ) ) ) } else { @@ -145,7 +158,8 @@ constructor( private val store: SearchTermsStore, private val selectedDateProvider: SelectedDateProvider, private val statsSiteProvider: StatsSiteProvider, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = SearchTermsUseCase( @@ -155,6 +169,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/VideoPlaysUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/VideoPlaysUseCase.kt index 8393f41c5e40..10bd972af86d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/VideoPlaysUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/VideoPlaysUseCase.kt @@ -24,6 +24,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularStatelessUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.granular.GranularUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.granular.SelectedDateProvider +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import org.wordpress.android.ui.stats.refresh.utils.trackGranular @@ -43,6 +44,7 @@ constructor( statsSiteProvider: StatsSiteProvider, selectedDateProvider: SelectedDateProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : GranularStatelessUseCase( VIDEOS, @@ -92,13 +94,19 @@ constructor( if (domainModel.plays.isEmpty()) { items.add(Empty(R.string.stats_no_data_for_period)) } else { - items.add(Header(R.string.stats_videos_title_label, R.string.stats_videos_views_label)) + val header = Header(R.string.stats_videos_title_label, R.string.stats_videos_views_label) + items.add(header) items.addAll(domainModel.plays.mapIndexed { index, videoPlays -> ListItemWithIcon( text = videoPlays.title, value = videoPlays.plays.toFormattedString(), showDivider = index < domainModel.plays.size - 1, - navigationAction = videoPlays.url?.let { NavigationAction.create(it, this::onItemClick) } + navigationAction = videoPlays.url?.let { NavigationAction.create(it, this::onItemClick) }, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + videoPlays.title, + videoPlays.plays + ) ) }) @@ -135,7 +143,8 @@ constructor( private val store: VideoPlaysStore, private val selectedDateProvider: SelectedDateProvider, private val statsSiteProvider: StatsSiteProvider, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper ) : GranularUseCaseFactory { override fun build(granularity: StatsGranularity, useCaseMode: UseCaseMode) = VideoPlaysUseCase( @@ -145,6 +154,7 @@ constructor( statsSiteProvider, selectedDateProvider, analyticsTracker, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/AnnualStatsMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/AnnualStatsMapper.kt index f39a54a44450..cbb07188a103 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/AnnualStatsMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/AnnualStatsMapper.kt @@ -6,11 +6,12 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.QuickScanItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.QuickScanItem.Column +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import javax.inject.Inject class AnnualStatsMapper -@Inject constructor() { +@Inject constructor(private val contentDescriptionHelper: ContentDescriptionHelper) { fun mapYearInBlock(selectedYear: YearInsights): List { return listOf( QuickScanItem( @@ -58,33 +59,45 @@ class AnnualStatsMapper fun mapYearInViewAll(selectedYear: YearInsights): List { return listOf( - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_posts, value = selectedYear.totalPosts.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_total_comments, value = selectedYear.totalComments.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_average_comments, - value = selectedYear.avgComments?.toFormattedString() ?: "0" + value = selectedYear.avgComments?.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_total_likes, value = selectedYear.totalLikes.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_average_likes, - value = selectedYear.avgLikes?.toFormattedString() ?: "0" + value = selectedYear.avgLikes?.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_total_words, value = selectedYear.totalWords.toFormattedString() ), - ListItemWithIcon( + mapItem( textResource = R.string.stats_insights_average_words, - value = selectedYear.avgWords?.toFormattedString() ?: "0" + value = selectedYear.avgWords?.toFormattedString() + ) + ) + } + + private fun mapItem(textResource: Int, value: String?): ListItemWithIcon { + val nonNullValue = value ?: "0" + return ListItemWithIcon( + textResource = textResource, + value = nonNullValue, + contentDescription = contentDescriptionHelper.buildContentDescription( + textResource, + nonNullValue ) ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/CommentsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/CommentsUseCase.kt index b5f7d12f2d7a..e071959e182b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/CommentsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/CommentsUseCase.kt @@ -17,6 +17,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListI import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon.IconStyle.AVATAR import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.TabsItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.ItemPopupMenuHandler import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString @@ -32,7 +33,8 @@ class CommentsUseCase @Named(UI_THREAD) private val mainDispatcher: CoroutineDispatcher, private val commentsStore: CommentsStore, private val statsSiteProvider: StatsSiteProvider, - private val popupMenuHandler: ItemPopupMenuHandler + private val popupMenuHandler: ItemPopupMenuHandler, + private val contentDescriptionHelper: ContentDescriptionHelper ) : BaseStatsUseCase(COMMENTS, mainDispatcher, 0) { override suspend fun fetchRemoteData(forced: Boolean): State { val fetchMode = LimitMode.Top(BLOCK_ITEM_COUNT) @@ -88,14 +90,20 @@ class CommentsUseCase private fun buildAuthorsTab(authors: List): List { val mutableItems = mutableListOf() if (authors.isNotEmpty()) { - mutableItems.add(Header(R.string.stats_comments_author_label, R.string.stats_comments_label)) + val header = Header(R.string.stats_comments_author_label, R.string.stats_comments_label) + mutableItems.add(header) mutableItems.addAll(authors.mapIndexed { index, author -> ListItemWithIcon( iconUrl = author.gravatar, iconStyle = AVATAR, text = author.name, value = author.comments.toFormattedString(), - showDivider = index < authors.size - 1 + showDivider = index < authors.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + author.name, + author.comments + ) ) }) } else { @@ -107,12 +115,18 @@ class CommentsUseCase private fun buildPostsTab(posts: List): List { val mutableItems = mutableListOf() if (posts.isNotEmpty()) { - mutableItems.add(Header(R.string.stats_comments_title_label, R.string.stats_comments_label)) + val header = Header(R.string.stats_comments_title_label, R.string.stats_comments_label) + mutableItems.add(header) mutableItems.addAll(posts.mapIndexed { index, post -> ListItem( post.name, post.comments.toFormattedString(), - index < posts.size - 1 + index < posts.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + post.name, + post.comments + ) ) }) } else { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowerTotalsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowerTotalsUseCase.kt index de4acfaf7906..8ec6ef6d417b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowerTotalsUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowerTotalsUseCase.kt @@ -20,6 +20,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.F import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.FollowerTotalsUseCase.FollowerType.EMAIL import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.FollowerTotalsUseCase.FollowerType.SOCIAL import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.FollowerTotalsUseCase.FollowerType.WP_COM +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.toFormattedString import javax.inject.Inject @@ -31,7 +32,8 @@ class FollowerTotalsUseCase @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher, private val followersStore: FollowersStore, private val publicizeStore: PublicizeStore, - private val statsSiteProvider: StatsSiteProvider + private val statsSiteProvider: StatsSiteProvider, + private val contentDescriptionHelper: ContentDescriptionHelper ) : StatelessUseCase>(FOLLOWER_TOTALS, mainDispatcher) { override fun buildLoadingItem(): List = listOf(Title(R.string.stats_view_follower_totals)) @@ -137,12 +139,19 @@ class FollowerTotalsUseCase if (domainModel.isNotEmpty()) { domainModel.entries.forEach { - items.add(ListItemWithIcon( - icon = getIcon(it.key), - textResource = getTitle(it.key), - value = it.value.toFormattedString(), - showDivider = domainModel.entries.indexOf(it) < domainModel.size - 1 - )) + val title = getTitle(it.key) + items.add( + ListItemWithIcon( + icon = getIcon(it.key), + textResource = title, + value = it.value.toFormattedString(), + showDivider = domainModel.entries.indexOf(it) < domainModel.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + title, + it.value + ) + ) + ) } } else { items.add(Empty()) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowersUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowersUseCase.kt index eea35d39e832..27a86d6e425e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowersUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/FollowersUseCase.kt @@ -34,6 +34,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.TabsI import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.insights.InsightUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.FollowersUseCase.FollowersUiState +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.ItemPopupMenuHandler import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper @@ -53,6 +54,7 @@ class FollowersUseCase( private val resourceProvider: ResourceProvider, private val analyticsTracker: AnalyticsTrackerWrapper, private val popupMenuHandler: ItemPopupMenuHandler, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : BaseStatsUseCase, FollowersUiState>( FOLLOWERS, @@ -195,22 +197,30 @@ class FollowersUseCase( ) ) ) - mutableItems.add(Header(R.string.stats_follower_label, R.string.stats_follower_since_label)) - model.followers.toUserItems().let { mutableItems.addAll(it) } + val header = Header(R.string.stats_follower_label, R.string.stats_follower_since_label) + mutableItems.add(header) + model.followers.toUserItems(header) + .let { mutableItems.addAll(it) } } else { mutableItems.add(Empty()) } return mutableItems } - private fun List.toUserItems(): List { + private fun List.toUserItems(header: Header): List { return this.mapIndexed { index, follower -> + val value = statsUtilsWrapper.getSinceLabelLowerCase(follower.dateSubscribed) ListItemWithIcon( iconUrl = follower.avatar, iconStyle = AVATAR, text = follower.label, - value = statsUtilsWrapper.getSinceLabelLowerCase(follower.dateSubscribed), - showDivider = index < this.size - 1 + value = value, + showDivider = index < this.size - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + follower.label, + value + ) ) } } @@ -235,7 +245,8 @@ class FollowersUseCase( private val statsUtilsWrapper: StatsUtilsWrapper, private val resourceProvider: ResourceProvider, private val popupMenuHandler: ItemPopupMenuHandler, - private val analyticsTracker: AnalyticsTrackerWrapper + private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper ) : InsightUseCaseFactory { override fun build(useCaseMode: UseCaseMode) = FollowersUseCase( @@ -247,6 +258,7 @@ class FollowersUseCase( resourceProvider, analyticsTracker, popupMenuHandler, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/LatestPostSummaryUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/LatestPostSummaryUseCase.kt index 395503fa4f0c..d9d7d1e3cb3d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/LatestPostSummaryUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/LatestPostSummaryUseCase.kt @@ -22,6 +22,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListI import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.NavigationAction import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ValueItem +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.ItemPopupMenuHandler import org.wordpress.android.ui.stats.refresh.utils.MILLION import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider @@ -37,7 +38,8 @@ class LatestPostSummaryUseCase private val statsSiteProvider: StatsSiteProvider, private val latestPostSummaryMapper: LatestPostSummaryMapper, private val analyticsTracker: AnalyticsTrackerWrapper, - private val popupMenuHandler: ItemPopupMenuHandler + private val popupMenuHandler: ItemPopupMenuHandler, + private val contentDescriptionHelper: ContentDescriptionHelper ) : StatelessUseCase(LATEST_POST_SUMMARY, mainDispatcher) { override suspend fun loadCachedData(): InsightsLatestPostModel? { return latestPostStore.getLatestPostInsights(statsSiteProvider.siteModel) @@ -75,26 +77,40 @@ class LatestPostSummaryUseCase items.add( ValueItem( domainModel.postViewsCount.toFormattedString(startValue = MILLION), - R.string.stats_views + R.string.stats_views, + contentDescription = contentDescriptionHelper.buildContentDescription( + R.string.stats_views, + domainModel.postViewsCount + ) ) ) if (domainModel.dayViews.isNotEmpty()) { items.add(latestPostSummaryMapper.buildBarChartItem(domainModel.dayViews)) } + val postLikeCount = domainModel.postLikeCount.toFormattedString() items.add( ListItemWithIcon( R.drawable.ic_star_white_24dp, textResource = R.string.stats_likes, - value = domainModel.postLikeCount.toFormattedString(), - showDivider = true + value = postLikeCount, + showDivider = true, + contentDescription = contentDescriptionHelper.buildContentDescription( + R.string.stats_likes, + domainModel.postLikeCount + ) ) ) + val postCommentCount = domainModel.postCommentCount.toFormattedString() items.add( ListItemWithIcon( R.drawable.ic_comment_white_24dp, textResource = R.string.stats_comments, - value = domainModel.postCommentCount.toFormattedString(), - showDivider = false + value = postCommentCount, + showDivider = false, + contentDescription = contentDescriptionHelper.buildContentDescription( + R.string.stats_comments, + domainModel.postCommentCount + ) ) ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/PublicizeUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/PublicizeUseCase.kt index 8e0aec9de598..e650e56dcab7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/PublicizeUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/PublicizeUseCase.kt @@ -3,7 +3,6 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases import android.view.View import kotlinx.coroutines.CoroutineDispatcher import org.wordpress.android.R -import org.wordpress.android.R.string import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.fluxc.model.stats.LimitMode import org.wordpress.android.fluxc.model.stats.PublicizeModel @@ -84,12 +83,15 @@ class PublicizeUseCase if (domainModel.services.isEmpty()) { items.add(Empty()) } else { - items.add(Header(string.stats_publicize_service_label, string.stats_publicize_followers_label)) - items.addAll(domainModel.services.let { mapper.map(it) }) + val header = Header(R.string.stats_publicize_service_label, R.string.stats_publicize_followers_label) + items.add(header) + items.addAll(domainModel.services.let { + mapper.map(it, header) + }) if (useCaseMode == BLOCK && domainModel.hasMore) { items.add( Link( - text = string.stats_insights_view_more, + text = R.string.stats_insights_view_more, navigateAction = NavigationAction.create(this::onLinkClick) ) ) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/TagsAndCategoriesUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/TagsAndCategoriesUseCase.kt index 365f771d1762..24a9783f17f6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/TagsAndCategoriesUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/TagsAndCategoriesUseCase.kt @@ -3,8 +3,6 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases import android.view.View import kotlinx.coroutines.CoroutineDispatcher import org.wordpress.android.R -import org.wordpress.android.R.drawable -import org.wordpress.android.R.string import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.fluxc.model.stats.LimitMode import org.wordpress.android.fluxc.model.stats.TagsModel @@ -29,6 +27,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Navig import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title import org.wordpress.android.ui.stats.refresh.lists.sections.insights.InsightUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.TagsAndCategoriesUseCase.TagsAndCategoriesUiState +import org.wordpress.android.ui.stats.refresh.utils.ContentDescriptionHelper import org.wordpress.android.ui.stats.refresh.utils.ItemPopupMenuHandler import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import org.wordpress.android.ui.stats.refresh.utils.getBarWidth @@ -49,6 +48,7 @@ class TagsAndCategoriesUseCase private val resourceProvider: ResourceProvider, private val analyticsTracker: AnalyticsTrackerWrapper, private val popupMenuHandler: ItemPopupMenuHandler, + private val contentDescriptionHelper: ContentDescriptionHelper, private val useCaseMode: UseCaseMode ) : BaseStatsUseCase( TAGS_AND_CATEGORIES, @@ -89,29 +89,30 @@ class TagsAndCategoriesUseCase if (domainModel.tags.isEmpty()) { items.add(Empty()) } else { + val header = Header( + R.string.stats_tags_and_categories_title_label, + R.string.stats_tags_and_categories_views_label + ) items.add( - Header( - string.stats_tags_and_categories_title_label, - string.stats_tags_and_categories_views_label - ) + header ) val tagsList = mutableListOf() val maxViews = domainModel.tags.maxBy { it.views }?.views ?: 0 domainModel.tags.forEachIndexed { index, tag -> when { tag.items.size == 1 -> { - tagsList.add(mapTag(tag, index, domainModel.tags.size, maxViews)) + tagsList.add(mapTag(tag, index, domainModel.tags.size, maxViews, header)) } else -> { val isExpanded = areTagsEqual(tag, uiState.expandedTag) tagsList.add(ExpandableItem( - mapCategory(tag, index, domainModel.tags.size, maxViews), + mapCategory(tag, index, domainModel.tags.size, maxViews, header), isExpanded ) { changedExpandedState -> onUiState(uiState.copy(expandedTag = if (changedExpandedState) tag else null)) }) if (isExpanded) { - tagsList.addAll(tag.items.map { subTag -> mapItem(subTag) }) + tagsList.addAll(tag.items.map { subTag -> mapItem(subTag, header) }) tagsList.add(Divider) } } @@ -131,13 +132,13 @@ class TagsAndCategoriesUseCase return items } - private fun buildTitle() = Title(string.stats_insights_tags_and_categories, menuAction = this::onMenuClick) + private fun buildTitle() = Title(R.string.stats_insights_tags_and_categories, menuAction = this::onMenuClick) private fun areTagsEqual(tagA: TagModel, tagB: TagModel?): Boolean { return tagA.items == tagB?.items && tagA.views == tagB.views } - private fun mapTag(tag: TagModel, index: Int, listSize: Int, maxViews: Long): ListItemWithIcon { + private fun mapTag(tag: TagModel, index: Int, listSize: Int, maxViews: Long, header: Header): ListItemWithIcon { val item = tag.items.first() return ListItemWithIcon( icon = getIcon(item.type), @@ -145,11 +146,22 @@ class TagsAndCategoriesUseCase value = tag.views.toFormattedString(), barWidth = getBarWidth(tag.views, maxViews), showDivider = index < listSize - 1, - navigationAction = NavigationAction.create(item.link, this::onTagClick) + navigationAction = NavigationAction.create(item.link, this::onTagClick), + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + item.name, + tag.views + ) ) } - private fun mapCategory(tag: TagModel, index: Int, listSize: Int, maxViews: Long): ListItemWithIcon { + private fun mapCategory( + tag: TagModel, + index: Int, + listSize: Int, + maxViews: Long, + header: Header + ): ListItemWithIcon { val text = tag.items.foldIndexed("") { itemIndex, acc, item -> when (itemIndex) { 0 -> item.name @@ -161,22 +173,31 @@ class TagsAndCategoriesUseCase text = text, value = tag.views.toFormattedString(), barWidth = getBarWidth(tag.views, maxViews), - showDivider = index < listSize - 1 + showDivider = index < listSize - 1, + contentDescription = contentDescriptionHelper.buildContentDescription( + header, + text, + tag.views + ) ) } - private fun mapItem(item: TagModel.Item): ListItemWithIcon { + private fun mapItem(item: TagModel.Item, header: Header): ListItemWithIcon { return ListItemWithIcon( icon = getIcon(item.type), textStyle = LIGHT, text = item.name, showDivider = false, - navigationAction = NavigationAction.create(item.link, this::onTagClick) + navigationAction = NavigationAction.create(item.link, this::onTagClick), + contentDescription = contentDescriptionHelper.buildContentDescription( + header.startLabel, + item.name + ) ) } private fun getIcon(type: String) = - if (type == "tag") drawable.ic_tag_white_24dp else drawable.ic_folder_white_24dp + if (type == "tag") R.drawable.ic_tag_white_24dp else R.drawable.ic_folder_white_24dp private fun onLinkClick() { analyticsTracker.track(AnalyticsTracker.Stat.STATS_TAGS_AND_CATEGORIES_VIEW_MORE_TAPPED) @@ -201,6 +222,7 @@ class TagsAndCategoriesUseCase private val statsSiteProvider: StatsSiteProvider, private val resourceProvider: ResourceProvider, private val analyticsTracker: AnalyticsTrackerWrapper, + private val contentDescriptionHelper: ContentDescriptionHelper, private val popupMenuHandler: ItemPopupMenuHandler ) : InsightUseCaseFactory { override fun build(useCaseMode: UseCaseMode) = @@ -211,6 +233,7 @@ class TagsAndCategoriesUseCase resourceProvider, analyticsTracker, popupMenuHandler, + contentDescriptionHelper, useCaseMode ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt index 7c2526b9c5c6..dcfc42ca205f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt @@ -79,11 +79,11 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( data = BarData(dataSets) val greyColor = ContextCompat.getColor( context, - R.color.neutral_300 + R.color.neutral_30 ) val lightGreyColor = ContextCompat.getColor( context, - R.color.neutral_50 + R.color.neutral_5 ) axisLeft.apply { valueFormatter = LargeValueFormatter() @@ -184,7 +184,7 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( dataSet.setGradientColor( ContextCompat.getColor( context, - R.color.primary_50 + R.color.primary_5 ), ContextCompat.getColor( context, android.R.color.transparent @@ -199,14 +199,14 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") - dataSet.color = ContextCompat.getColor(context, R.color.blue_400) + dataSet.color = ContextCompat.getColor(context, R.color.blue_40) dataSet.setGradientColor( ContextCompat.getColor( context, - R.color.blue_400 + R.color.blue_40 ), ContextCompat.getColor( context, - R.color.blue_400 + R.color.blue_40 ) ) dataSet.formLineWidth = 0f @@ -214,7 +214,7 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( dataSet.isHighlightEnabled = true dataSet.highLightColor = ContextCompat.getColor( context, - R.color.accent_400 + R.color.accent_40 ) dataSet.highLightAlpha = 255 return dataSet @@ -222,14 +222,14 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildOverlappingDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Overlapping data") - dataSet.color = ContextCompat.getColor(context, R.color.primary_700) + dataSet.color = ContextCompat.getColor(context, R.color.primary_70) dataSet.setGradientColor( ContextCompat.getColor( context, - R.color.primary_700 + R.color.primary_70 ), ContextCompat.getColor( context, - R.color.primary_700 + R.color.primary_70 ) ) dataSet.formLineWidth = 0f @@ -237,7 +237,7 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( dataSet.isHighlightEnabled = true dataSet.highLightColor = ContextCompat.getColor( context, - R.color.accent_700 + R.color.accent_70 ) dataSet.highLightAlpha = 255 return dataSet @@ -263,7 +263,7 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( dataSet.isHighlightEnabled = true dataSet.highLightColor = ContextCompat.getColor( context, - R.color.accent_400 + R.color.accent_40 ) dataSet.setDrawValues(false) dataSet.highLightAlpha = 51 diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BlockListItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BlockListItemViewHolder.kt index 8fd9e673f7ab..c785a124baef 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BlockListItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BlockListItemViewHolder.kt @@ -45,7 +45,7 @@ open class BlockListItemViewHolder( ) { when { item.icon != null -> { - this.imageTintList = ColorStateList.valueOf(ContextCompat.getColor(this.context, R.color.neutral_700)) + this.imageTintList = ColorStateList.valueOf(ContextCompat.getColor(this.context, R.color.neutral_70)) this.visibility = View.VISIBLE imageManager.load(this, item.icon) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/DayViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/DayViewHolder.kt index 04600854d2b7..ff366eff8254 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/DayViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/DayViewHolder.kt @@ -23,11 +23,11 @@ class DayViewHolder(parent: ViewGroup) : ViewHolder( fun bind(box: Box) { val color = when (box) { INVISIBLE -> android.R.color.transparent - VERY_LOW -> R.color.neutral_100 + VERY_LOW -> R.color.neutral_10 LOW -> R.color.stats_activity_low MEDIUM -> R.color.stats_activity_medium HIGH -> R.color.stats_activity_high - VERY_HIGH -> R.color.neutral_700 + VERY_HIGH -> R.color.neutral_70 } itemView.setBackgroundColor(ContextCompat.getColor(itemView.context, color)) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ExpandableItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ExpandableItemViewHolder.kt index 5af4c8a05b4c..c944e1d4e45b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ExpandableItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ExpandableItemViewHolder.kt @@ -30,7 +30,13 @@ class ExpandableItemViewHolder(parent: ViewGroup, val imageManager: ImageManager val header = expandableItem.header iconContainer.setIconOrAvatar(header, imageManager) text.setTextOrHide(header.textResource, header.text) + text.contentDescription = header.contentDescription expandButton.visibility = View.VISIBLE + val expandButtonDescription = when (expandableItem.isExpanded) { + true -> R.string.stats_collapse_content_description + false -> R.string.stats_expand_content_description + } + expandButton.contentDescription = itemView.resources.getString(expandButtonDescription) value.setTextOrHide(header.valueResource, header.value) divider.setVisible(header.showDivider && !expandableItem.isExpanded) if (header.barWidth != null) { @@ -48,6 +54,12 @@ class ExpandableItemViewHolder(parent: ViewGroup, val imageManager: ImageManager } itemView.isClickable = true itemView.setOnClickListener { + val announcement = if (expandableItem.isExpanded) { + itemView.resources.getString(R.string.stats_item_collapsed) + } else { + itemView.resources.getString(R.string.stats_item_expanded) + } + itemView.announceForAccessibility(announcement) expandableItem.onExpandClicked(!expandableItem.isExpanded) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/FourColumnsViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/FourColumnsViewHolder.kt index ec11d574946a..62fdb524742b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/FourColumnsViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/FourColumnsViewHolder.kt @@ -21,7 +21,7 @@ class FourColumnsViewHolder(parent: ViewGroup) : BlockListItemViewHolder( ) fun bind( - columns: Columns, + item: Columns, payloads: List ) { val tabSelected = payloads.contains(SELECTED_COLUMN_CHANGED) @@ -29,22 +29,25 @@ class FourColumnsViewHolder(parent: ViewGroup) : BlockListItemViewHolder( when { tabSelected -> { columnLayouts.forEachIndexed { index, layout -> - layout.setSelection(columns.selectedColumn == index) + layout.setSelection(item.selectedColumn == index) } } valuesChanged -> { columnLayouts.forEachIndexed { index, layout -> - layout.value().text = columns.values[index] + layout.value().text = item.columns[index].value } } else -> { columnLayouts.forEachIndexed { index, layout -> layout.setOnClickListener { - columns.onColumnSelected?.invoke(index) + it.announceForAccessibility(it.resources.getString(R.string.stats_graph_updated)) + item.onColumnSelected?.invoke(index) } - layout.key().setText(columns.headers[index]) - layout.value().text = columns.values[index] - layout.setSelection(columns.selectedColumn == null || columns.selectedColumn == index) + val currentColumn = item.columns[index] + layout.key().setText(currentColumn.header) + layout.value().text = currentColumn.value + layout.setSelection(item.selectedColumn == null || item.selectedColumn == index) + layout.contentDescription = currentColumn.contentDescription } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/LinkViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/LinkViewHolder.kt index 88897832ad8e..9ed63c09e2c9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/LinkViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/LinkViewHolder.kt @@ -16,7 +16,7 @@ class LinkViewHolder(parent: ViewGroup) : BlockListItemViewHolder( fun bind(item: Link) { if (item.icon != null) { - val drawable = ColorUtils.applyTintToDrawable(text.context, item.icon, R.color.primary_400) + val drawable = ColorUtils.applyTintToDrawable(text.context, item.icon, R.color.primary_40) text.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null) } else { text.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemViewHolder.kt index f5b7ac51ac8b..cc4dbd233e21 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemViewHolder.kt @@ -25,5 +25,6 @@ class ListItemViewHolder(parent: ViewGroup) : BlockListItemViewHolder( } else { View.GONE } + itemView.contentDescription = item.contentDescription } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithIconViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithIconViewHolder.kt index f4821741ccb2..0464f91ae342 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithIconViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithIconViewHolder.kt @@ -1,5 +1,6 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.viewholders +import android.util.TypedValue import android.view.View import android.view.ViewGroup import android.widget.LinearLayout @@ -27,8 +28,8 @@ class ListItemWithIconViewHolder(parent: ViewGroup, val imageManager: ImageManag iconContainer.setIconOrAvatar(item, imageManager) text.setTextOrHide(item.textResource, item.text) val textColor = when (item.textStyle) { - TextStyle.NORMAL -> R.color.neutral_700 - LIGHT -> R.color.neutral_500 + TextStyle.NORMAL -> R.color.neutral_70 + LIGHT -> R.color.neutral_50 } text.setTextColor(ContextCompat.getColor(text.context, textColor)) value.setTextOrHide(item.valueResource, item.value) @@ -39,12 +40,14 @@ class ListItemWithIconViewHolder(parent: ViewGroup, val imageManager: ImageManag } val clickAction = item.navigationAction if (clickAction != null) { - itemView.isClickable = true + val outValue = TypedValue() + itemView.context.theme.resolveAttribute(android.R.attr.selectableItemBackground, outValue, true) + itemView.setBackgroundResource(outValue.resourceId) itemView.setOnClickListener { clickAction.click() } } else { - itemView.isClickable = false - itemView.background = null itemView.setOnClickListener(null) + itemView.background = null + itemView.isClickable = false } if (item.barWidth != null) { bar.visibility = View.VISIBLE @@ -54,5 +57,6 @@ class ListItemWithIconViewHolder(parent: ViewGroup, val imageManager: ImageManag bar.visibility = View.GONE topMargin.visibility = View.GONE } + itemView.contentDescription = item.contentDescription } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/MapViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/MapViewHolder.kt index 1b6023397623..f07ac10abc0a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/MapViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/MapViewHolder.kt @@ -32,12 +32,12 @@ class MapViewHolder(parent: ViewGroup) : BlockListItemViewHolder( // Loading the v42 of the Google Charts API, since the latest stable version has a problem with // the legend. https://github.com/wordpress-mobile/WordPress-Android/issues/4131 // https://developers.google.com/chart/interactive/docs/release_notes#release-candidate-details - val colorLow = Integer.toHexString(ContextCompat.getColor(itemView.context, R.color.accent_50) and 0xffffff) + val colorLow = Integer.toHexString(ContextCompat.getColor(itemView.context, R.color.accent_5) and 0xffffff) val colorHigh = Integer.toHexString(ContextCompat.getColor(itemView.context, R.color.accent) and 0xffffff) val emptyColor = Integer.toHexString( ContextCompat.getColor( itemView.context, - R.color.neutral_50 + R.color.neutral_5 ) and 0xffffff ) val htmlPage = ("" + diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/QuickScanItemViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/QuickScanItemViewHolder.kt index 9f4333b72766..6ddaf4a67149 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/QuickScanItemViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/QuickScanItemViewHolder.kt @@ -1,6 +1,7 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.viewholders import android.view.ViewGroup +import android.widget.LinearLayout import android.widget.TextView import androidx.appcompat.widget.TooltipCompat import org.wordpress.android.R @@ -11,20 +12,32 @@ class QuickScanItemViewHolder(parent: ViewGroup) : BlockListItemViewHolder( parent, R.layout.stats_quick_scan_item ) { + private val startValueContainer = itemView.findViewById(R.id.start_value_container) private val startLabel = itemView.findViewById(R.id.start_label) private val startValue = itemView.findViewById(R.id.start_value) + private val endValueContainer = itemView.findViewById(R.id.end_value_container) private val endLabel = itemView.findViewById(R.id.end_label) private val endValue = itemView.findViewById(R.id.end_value) fun bind(item: QuickScanItem) { - bindColumn(item.startColumn, startLabel, startValue) - bindColumn(item.endColumn, endLabel, endValue) + bindColumn(item.startColumn, startLabel, startValue, startValueContainer) + bindColumn(item.endColumn, endLabel, endValue, endValueContainer) } - private fun bindColumn(column: Column, label: TextView, value: TextView) { + private fun bindColumn( + column: Column, + label: TextView, + value: TextView, + container: LinearLayout + ) { label.setText(column.label) value.text = column.value - TooltipCompat.setTooltipText(value, column.tooltip) - value.setOnClickListener { it.performLongClick() } + column.tooltip?.let { + TooltipCompat.setTooltipText(container, column.tooltip) + container.setOnClickListener { + container.announceForAccessibility(column.tooltip) + it.performLongClick() + } + } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/TextViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/TextViewHolder.kt index e75ba85e4bfe..c51634c80c60 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/TextViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/TextViewHolder.kt @@ -50,7 +50,7 @@ class TextViewHolder(parent: ViewGroup) : BlockListItemViewHolder( override fun updateDrawState(ds: TextPaint?) { ds?.color = ContextCompat.getColor( context, - R.color.primary_500 + R.color.primary_50 ) ds?.typeface = Typeface.create( Typeface.DEFAULT_BOLD, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ValueViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ValueViewHolder.kt index f0a4126b85fb..bfc4411a4b8d 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ValueViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ValueViewHolder.kt @@ -25,9 +25,9 @@ class ValueViewHolder(parent: ViewGroup) : BlockListItemViewHolder( unit.setText(item.unit) val hasChange = item.change != null val color = when (item.state) { - POSITIVE -> R.color.success_500 - NEGATIVE -> R.color.error_500 - NEUTRAL -> R.color.gray_500 + POSITIVE -> R.color.success_50 + NEGATIVE -> R.color.error_50 + NEUTRAL -> R.color.gray_50 } change.setTextColor(ContextCompat.getColor(change.context, color)) change.visibility = if (hasChange) View.VISIBLE else View.GONE @@ -36,5 +36,6 @@ class ValueViewHolder(parent: ViewGroup) : BlockListItemViewHolder( val topMargin = if (item.isFirst) container.resources.getDimensionPixelSize(R.dimen.margin_medium) else 0 params.setMargins(0, topMargin, 0, 0) container.layoutParams = params + container.contentDescription = item.contentDescription } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ContentDescriptionHelper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ContentDescriptionHelper.kt new file mode 100644 index 000000000000..7aa4937cc582 --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ContentDescriptionHelper.kt @@ -0,0 +1,41 @@ +package org.wordpress.android.ui.stats.refresh.utils + +import androidx.annotation.StringRes +import org.wordpress.android.R +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Header +import org.wordpress.android.util.RtlUtils +import org.wordpress.android.viewmodel.ResourceProvider +import javax.inject.Inject + +class ContentDescriptionHelper +@Inject constructor(private val resourceProvider: ResourceProvider, private val rtlUtils: RtlUtils) { + fun buildContentDescription(header: Header, key: String, value: Any): String { + return buildContentDescription(header.startLabel, key, header.endLabel, value) + } + + fun buildContentDescription( + @StringRes keyLabel: Int, + key: String, + @StringRes valueLabel: Int, + value: Any + ): String { + return resourceProvider.getString( + R.string.stats_list_item_description, + resourceProvider.getString(keyLabel), + key, + resourceProvider.getString(valueLabel), + value + ) + } + + fun buildContentDescription(header: Header, @StringRes key: Int, value: Any): String { + return buildContentDescription(header, resourceProvider.getString(key), value) + } + + fun buildContentDescription(keyLabel: Int, key: Any): String { + return when (rtlUtils.isRtl) { + true -> "$key :${resourceProvider.getString(keyLabel)}" + false -> "${resourceProvider.getString(keyLabel)}: $key" + } + } +} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ServiceMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ServiceMapper.kt index fc29984ba44c..4fdfa066f3ac 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ServiceMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/ServiceMapper.kt @@ -3,6 +3,7 @@ package org.wordpress.android.ui.stats.refresh.utils import androidx.annotation.StringRes import org.wordpress.android.R import org.wordpress.android.fluxc.model.stats.PublicizeModel +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Header import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon import org.wordpress.android.ui.stats.refresh.utils.ServiceMapper.Service.FACEBOOK import org.wordpress.android.ui.stats.refresh.utils.ServiceMapper.Service.GOOGLE_PLUS @@ -21,17 +22,30 @@ private const val LINKED_IN_ICON = "https://secure.gravatar.com/blavatar/f54db46 private const val PATH_ICON = "https://secure.gravatar.com/blavatar/3a03c8ce5bf1271fb3760bb6e79b02c1?s=" class ServiceMapper -@Inject constructor(private val resourceProvider: ResourceProvider) { - fun map(services: List): List { +@Inject constructor( + private val resourceProvider: ResourceProvider, + private val contentDescriptionHelper: ContentDescriptionHelper +) { + fun map( + services: List, + header: Header + ): List { val dimension = resourceProvider.getDimensionPixelSize(R.dimen.avatar_sz_small) return services.mapIndexed { index, service -> val mappedService = getService(service.name) + val text = if (mappedService?.nameResource == null) service.name else null + val contentDescription = contentDescriptionHelper.buildContentDescription( + header, + text ?: "", + service.followers + ) ListItemWithIcon( iconUrl = mappedService?.iconUrl?.let { it + dimension }, - text = if (mappedService?.nameResource == null) service.name else null, + text = text, textResource = mappedService?.nameResource, value = service.followers.toFormattedString(), - showDivider = index < services.size - 1 + showDivider = index < services.size - 1, + contentDescription = contentDescription ) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/themes/ThemeBrowserAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/themes/ThemeBrowserAdapter.java index f53b2b514a2d..5d00c612152e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/themes/ThemeBrowserAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/themes/ThemeBrowserAdapter.java @@ -165,10 +165,10 @@ private void configureCardView(ThemeViewHolder themeViewHolder, boolean isCurren Resources resources = mContext.getResources(); if (isCurrent) { ColorStateList color = ColorStateList.valueOf(ContextCompat.getColor(mContext, android.R.color.white)); - themeViewHolder.mDetailsView.setBackgroundColor(resources.getColor(R.color.primary_500)); + themeViewHolder.mDetailsView.setBackgroundColor(resources.getColor(R.color.primary_50)); themeViewHolder.mNameView.setTextColor(color); themeViewHolder.mActiveView.setVisibility(View.VISIBLE); - themeViewHolder.mCardView.setCardBackgroundColor(resources.getColor(R.color.primary_500)); + themeViewHolder.mCardView.setCardBackgroundColor(resources.getColor(R.color.primary_50)); themeViewHolder.mImageButton.setImageTintList(color); } else { ColorStateList color = ColorStateList.valueOf(ContextCompat.getColor(mContext, android.R.color.black)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java index d1e403300b3d..2ff1e1998fad 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java @@ -39,6 +39,7 @@ import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.FluxCUtils; import org.wordpress.android.util.MediaUtils; +import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.SqlUtils; import org.wordpress.android.util.analytics.AnalyticsUtils; import org.wordpress.android.util.helpers.MediaFile; @@ -280,16 +281,24 @@ private void prepareUploadAnalytics(String postContent) { sCurrentUploadingPostAnalyticsProperties = new HashMap<>(); sCurrentUploadingPostAnalyticsProperties .put("word_count", AnalyticsUtils.getWordCount(mPost.getContent())); - sCurrentUploadingPostAnalyticsProperties.put("editor_source", - // making sure to reuse the same logic for both showing Gutenberg and tracking. - // Note that mIsNewPost is not available as a flag-logic per se outside of EditPostActivity, - // but the check will pass anyway as long as Gutenberg is enabled and the PostModel contains - // Gutenberg blocks. As a proxy to mIsNewPost, we're using postModel.isLocalDraft(). The - // choice is loosely made knowing the other check ("contains blocks") is in place. - PostUtils.shouldShowGutenbergEditor(mPost.isLocalDraft(), mPost) ? "gutenberg" - : (AppPrefs.isAztecEditorEnabled() ? "aztec" - : AppPrefs.isVisualEditorEnabled() ? "hybrid" : "legacy")); - + // Add the editor source + int siteLocalId = mPost.getLocalSiteId(); + if (siteLocalId != -1) { + // Site found, use it + SiteModel selectedSite = mSiteStore.getSiteByLocalId(siteLocalId); + // If saved site exist, then add info + if (selectedSite != null) { + sCurrentUploadingPostAnalyticsProperties.put("editor_source", + // making sure to reuse the same logic for both showing Gutenberg and tracking. + // Note that mIsNewPost is not available as a flag-logic per se outside of + // EditPostActivity, but the check will pass anyway as long as Gutenberg is enabled + // and the PostModel contains Gutenberg blocks. + // As a proxy to mIsNewPost, we're using postModel.isLocalDraft(). The choice is + // loosely made knowing the other check ("contains blocks") is in place. + PostUtils.shouldShowGutenbergEditor(mPost.isLocalDraft(), mPost, selectedSite) + ? SiteUtils.GB_EDITOR_NAME : SiteUtils.AZTEC_EDITOR_NAME); + } + } if (hasGallery()) { sCurrentUploadingPostAnalyticsProperties.put("with_galleries", true); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadNotifier.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadNotifier.java index c630a9a7fb6f..d6c9867f77a4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadNotifier.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadNotifier.java @@ -81,7 +81,7 @@ private class NotificationData { mNotificationBuilder = new NotificationCompat.Builder(mContext.getApplicationContext(), context.getString(R.string.notification_channel_transient_id)); mNotificationBuilder.setSmallIcon(android.R.drawable.stat_sys_upload) - .setColor(context.getResources().getColor(R.color.primary_500)) + .setColor(context.getResources().getColor(R.color.primary_50)) .setOnlyAlertOnce(true); } @@ -320,7 +320,7 @@ void updateNotificationSuccessForPost(@NonNull PostModel post, @NonNull SiteMode } notificationBuilder.setSmallIcon(R.drawable.ic_my_sites_white_24dp); - notificationBuilder.setColor(mContext.getResources().getColor(R.color.primary_500)); + notificationBuilder.setColor(mContext.getResources().getColor(R.color.primary_50)); notificationBuilder.setContentTitle(notificationTitle); notificationBuilder.setContentText(notificationMessage); @@ -391,7 +391,7 @@ void updateNotificationSuccessForMedia(@NonNull List mediaList, @Non notificationIntent, PendingIntent.FLAG_ONE_SHOT); notificationBuilder.setSmallIcon(R.drawable.ic_my_sites_white_24dp); - notificationBuilder.setColor(mContext.getResources().getColor(R.color.primary_500)); + notificationBuilder.setColor(mContext.getResources().getColor(R.color.primary_50)); String notificationTitle = buildSuccessMessageForMedia(mediaList.size()); String notificationMessage = diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadStarter.kt b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadStarter.kt index 4d5895fb645d..b94d85d5bae1 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadStarter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadStarter.kt @@ -21,6 +21,7 @@ import org.wordpress.android.fluxc.store.SiteStore import org.wordpress.android.fluxc.store.UploadStore import org.wordpress.android.modules.BG_THREAD import org.wordpress.android.modules.IO_THREAD +import org.wordpress.android.testing.OpenForTesting import org.wordpress.android.ui.posts.PostUtilsWrapper import org.wordpress.android.util.CrashLoggingUtils import org.wordpress.android.util.NetworkUtilsWrapper @@ -40,7 +41,8 @@ import kotlin.coroutines.CoroutineContext * The method [activateAutoUploading] must be called once, preferably during app creation, for the auto-uploads to work. */ @Singleton -open class UploadStarter @Inject constructor( +@OpenForTesting +class UploadStarter @Inject constructor( /** * The Application context */ @@ -90,7 +92,7 @@ open class UploadStarter @Inject constructor( processLifecycleOwner.lifecycle.addObserver(processLifecycleObserver) } - open fun queueUploadFromAllSites() = launch { + fun queueUploadFromAllSites() = launch { val sites = siteStore.sites try { checkConnectionAndUpload(sites = sites) @@ -102,7 +104,7 @@ open class UploadStarter @Inject constructor( /** * Upload all local drafts from the given [site]. */ - open fun queueUploadFromSite(site: SiteModel) = launch { + fun queueUploadFromSite(site: SiteModel) = launch { try { checkConnectionAndUpload(sites = listOf(site)) } catch (e: Exception) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadUtils.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadUtils.java index cb6cc1ae9ffa..6d8103856b47 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadUtils.java @@ -27,7 +27,8 @@ import org.wordpress.android.ui.prefs.AppPrefs; import org.wordpress.android.ui.utils.UiString; import org.wordpress.android.ui.utils.UiString.UiStringRes; -import org.wordpress.android.ui.utils.UiString.UiStringText; +import org.wordpress.android.util.AppLog; +import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.NetworkUtils; import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.ToastUtils; @@ -81,9 +82,8 @@ UiString getErrorMessageResIdFromPostError(boolean isPage, PostError error) { case INVALID_RESPONSE: case GENERIC_ERROR: default: - // In case of a generic or uncaught error, return the message from the API response or the error type - return TextUtils.isEmpty(error.message) ? new UiStringText(error.type.toString()) - : new UiStringText(error.message); + AppLog.w(T.MAIN, "Error message: " + error.message + " ,Error Type: " + error.type); + return new UiStringRes(R.string.error_generic_error); } } diff --git a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java index 593a6225fed5..549c4632833c 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java @@ -1,19 +1,103 @@ package org.wordpress.android.util; +import android.content.Context; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import org.wordpress.android.fluxc.Dispatcher; +import org.wordpress.android.fluxc.generated.SiteActionBuilder; import org.wordpress.android.fluxc.model.SiteModel; import org.wordpress.android.fluxc.store.SiteStore; +import org.wordpress.android.fluxc.store.SiteStore.DesignateMobileEditorPayload; import org.wordpress.android.ui.plans.PlansConstants; +import org.wordpress.android.ui.prefs.AppPrefs; import org.wordpress.android.util.helpers.Version; import java.util.ArrayList; import java.util.List; public class SiteUtils { + public static final String GB_EDITOR_NAME = "gutenberg"; + public static final String AZTEC_EDITOR_NAME = "aztec"; + + /** + * Migrate the old app-wide editor preference value to per-site setting. wpcom sites will make a network call + * and store the value on the backend. selfHosted sites just store the value in the local DB in FluxC + * + * Strategy: Check if there is the old app-wide preference still available (v12.9 and before used it). + * -- 12.9 ON -> turn all sites ON in 13.0 + * -- 12.9 OPTED OUT (were auto-opted in but turned it OFF) -> turn all sites OFF in 13.0 + * + * @param dispatcher FluxC dispatcher + * @param siteStore SiteStore + */ + public static void migrateAppWideMobileEditorPreferenceToRemote(final Context context, + final Dispatcher dispatcher, + final SiteStore siteStore) { + if (!AppPrefs.isDefaultAppWideEditorPreferenceSet()) { + return; + } + final boolean oldAppWidePreferenceValue = AppPrefs.isGutenbergDefaultForNewPosts(); + final List sites = siteStore.getSites(); + final boolean setDelay = sites.size() > 5; + new Thread(new Runnable() { + @Override + public void run() { + // Be optimistic and remove the old app-wide preference before we start the calls + // Only do this when the network connection is available + if (NetworkUtils.isNetworkAvailable(context)) { + AppPrefs.removeAppWideEditorPreference(); + } + for (SiteModel currentSite : sites) { + if (oldAppWidePreferenceValue) { + enableBlockEditor(dispatcher, currentSite); + } else { + disableBlockEditor(dispatcher, currentSite); + } + if (setDelay) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + // no-op + } + } + } + } + }).start(); + } + + public static boolean enableBlockEditor(Dispatcher dispatcher, SiteStore siteStore, int siteLocalSiteID) { + SiteModel newSiteModel = siteStore.getSiteByLocalId(siteLocalSiteID); + if (newSiteModel != null) { + enableBlockEditor(dispatcher, newSiteModel); + return true; + } + return false; + } + + public static void enableBlockEditor(Dispatcher dispatcher, SiteModel siteModel) { + dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( + new DesignateMobileEditorPayload(siteModel, SiteUtils.GB_EDITOR_NAME))); + } + + public static void disableBlockEditor(Dispatcher dispatcher, SiteModel siteModel) { + dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( + new DesignateMobileEditorPayload(siteModel, SiteUtils.AZTEC_EDITOR_NAME))); + } + + public static boolean isBlockEditorDefaultForNewPost(SiteModel site) { + if (site == null) { + return false; + } + if (TextUtils.isEmpty(site.getMobileEditor())) { + return AppPrefs.isGutenbergDefaultForNewPosts(); + } else { + return site.getMobileEditor().equals(SiteUtils.GB_EDITOR_NAME); + } + } + public static String getSiteNameOrHomeURL(SiteModel site) { String siteName = site.getName(); if (siteName == null) { diff --git a/WordPress/src/main/java/org/wordpress/android/util/WPPrefUtils.java b/WordPress/src/main/java/org/wordpress/android/util/WPPrefUtils.java index d223bd6087d6..b6b872ba7a50 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/WPPrefUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/util/WPPrefUtils.java @@ -68,14 +68,14 @@ public static void layoutAsLightTitle(TextView view) { */ public static void layoutAsDarkTitle(TextView view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_extra_large); - setTextViewAttributes(view, size, R.color.neutral_700); + setTextViewAttributes(view, size, R.color.neutral_70); } /** * Styles a {@link TextView} to display medium sized text as a header with sub-elements. */ public static void layoutAsSubhead(TextView view) { - int color = view.isEnabled() ? R.color.neutral_700 : R.color.neutral_200; + int color = view.isEnabled() ? R.color.neutral_70 : R.color.neutral_20; int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_large); setTextViewAttributes(view, size, color); } @@ -84,7 +84,7 @@ public static void layoutAsSubhead(TextView view) { * Styles a {@link TextView} to display smaller text. */ public static void layoutAsBody1(TextView view) { - int color = view.isEnabled() ? R.color.neutral : R.color.neutral_200; + int color = view.isEnabled() ? R.color.neutral : R.color.neutral_20; int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_medium); setTextViewAttributes(view, size, color); } @@ -102,7 +102,7 @@ public static void layoutAsBody2(TextView view) { */ public static void layoutAsCaption(TextView view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_small); - setTextViewAttributes(view, size, R.color.neutral_400); + setTextViewAttributes(view, size, R.color.neutral_40); } /** @@ -110,7 +110,7 @@ public static void layoutAsCaption(TextView view) { */ public static void layoutAsFlatButton(TextView view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_medium); - setTextViewAttributes(view, size, R.color.primary_400); + setTextViewAttributes(view, size, R.color.primary_40); } /** @@ -126,9 +126,9 @@ public static void layoutAsRaisedButton(TextView view) { */ public static void layoutAsInput(EditText view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_large); - setTextViewAttributes(view, size, R.color.neutral_700); - view.setHintTextColor(view.getResources().getColor(R.color.neutral_200)); - view.setTextColor(view.getResources().getColor(R.color.neutral_700)); + setTextViewAttributes(view, size, R.color.neutral_70); + view.setHintTextColor(view.getResources().getColor(R.color.neutral_20)); + view.setTextColor(view.getResources().getColor(R.color.neutral_70)); view.setSingleLine(true); } @@ -137,7 +137,7 @@ public static void layoutAsInput(EditText view) { */ public static void layoutAsNumberPickerSelected(TextView view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_triple_extra_large); - setTextViewAttributes(view, size, R.color.primary_400); + setTextViewAttributes(view, size, R.color.primary_40); } /** @@ -145,7 +145,7 @@ public static void layoutAsNumberPickerSelected(TextView view) { */ public static void layoutAsNumberPickerPeek(TextView view) { int size = view.getResources().getDimensionPixelSize(R.dimen.text_sz_large); - setTextViewAttributes(view, size, R.color.neutral_700); + setTextViewAttributes(view, size, R.color.neutral_70); } /** diff --git a/WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java b/WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java index 967440014fd5..394b738dd934 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java +++ b/WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java @@ -105,7 +105,17 @@ public static void refreshMetadata(AccountStore accountStore, SiteStore siteStor metadata.setNumBlogs(siteStore.getSitesCount()); metadata.setUsername(accountStore.getAccount().getUserName()); metadata.setEmail(accountStore.getAccount().getEmail()); - metadata.setGutenbergEnabled(AppPrefs.isGutenbergDefaultForNewPosts()); + + int siteLocalId = AppPrefs.getSelectedSite(); + if (siteLocalId != -1) { + // Site previously selected, use it + SiteModel selectedSite = siteStore.getSiteByLocalId(siteLocalId); + // If saved site exist, then add info + if (selectedSite != null) { + metadata.setGutenbergEnabled( + SiteUtils.isBlockEditorDefaultForNewPost(selectedSite)); + } + } AnalyticsTracker.refreshMetadata(metadata); } @@ -127,7 +137,8 @@ public static void refreshMetadataNewUser(String username, String email) { metadata.setNumBlogs(1); metadata.setUsername(username); metadata.setEmail(email); - metadata.setGutenbergEnabled(AppPrefs.isGutenbergDefaultForNewPosts()); + // GB is enabled for new users + metadata.setGutenbergEnabled(true); AnalyticsTracker.refreshMetadata(metadata); } diff --git a/WordPress/src/main/java/org/wordpress/android/util/image/ImagePlaceholderManager.kt b/WordPress/src/main/java/org/wordpress/android/util/image/ImagePlaceholderManager.kt index b28c6ebd5c22..b5c601c3cd4c 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/image/ImagePlaceholderManager.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/image/ImagePlaceholderManager.kt @@ -8,13 +8,13 @@ import javax.inject.Singleton class ImagePlaceholderManager @Inject constructor() { fun getErrorResource(imgType: ImageType): Int? { return when (imgType) { - ImageType.AVATAR -> R.drawable.bg_rectangle_neutral_100_user_32dp - ImageType.AVATAR_WITH_BACKGROUND -> R.drawable.bg_oval_neutral_300_user_32dp + ImageType.AVATAR -> R.drawable.bg_rectangle_neutral_10_user_32dp + ImageType.AVATAR_WITH_BACKGROUND -> R.drawable.bg_oval_neutral_30_user_32dp ImageType.AVATAR_WITHOUT_BACKGROUND -> R.drawable.ic_user_circle_grey_24dp - ImageType.BLAVATAR -> R.drawable.bg_rectangle_neutral_100_globe_32dp + ImageType.BLAVATAR -> R.drawable.bg_rectangle_neutral_10_globe_32dp ImageType.IMAGE -> null // don't display any error drawable ImageType.PHOTO -> R.color.neutral_0 - ImageType.PLAN -> R.drawable.bg_oval_neutral_300_plans_32dp + ImageType.PLAN -> R.drawable.bg_oval_neutral_30_plans_32dp ImageType.PLUGIN -> R.drawable.plugin_placeholder ImageType.THEME -> R.color.neutral_0 ImageType.UNKNOWN -> R.drawable.ic_notice_white_24dp @@ -27,14 +27,14 @@ class ImagePlaceholderManager @Inject constructor() { fun getPlaceholderResource(imgType: ImageType): Int? { return when (imgType) { ImageType.AVATAR -> R.drawable.bg_oval_neutral_0 - ImageType.AVATAR_WITH_BACKGROUND -> R.drawable.bg_oval_neutral_300_user_32dp + ImageType.AVATAR_WITH_BACKGROUND -> R.drawable.bg_oval_neutral_30_user_32dp ImageType.AVATAR_WITHOUT_BACKGROUND -> R.drawable.ic_user_circle_grey_24dp ImageType.BLAVATAR -> R.color.neutral_0 ImageType.IMAGE -> null // don't display any placeholder ImageType.PHOTO -> R.color.neutral_0 - ImageType.PLAN -> R.drawable.bg_oval_neutral_300_plans_32dp + ImageType.PLAN -> R.drawable.bg_oval_neutral_30_plans_32dp ImageType.PLUGIN -> R.drawable.plugin_placeholder - ImageType.THEME -> R.drawable.bg_rectangle_neutral_100_themes_100dp + ImageType.THEME -> R.drawable.bg_rectangle_neutral_10_themes_100dp ImageType.UNKNOWN -> R.drawable.legacy_dashicon_format_image_big_grey ImageType.VIDEO -> R.color.neutral_0 ImageType.ICON -> R.drawable.bg_rectangle_neutral_0_radius_2dp diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/history/HistoryViewModel.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/history/HistoryViewModel.kt index f13c1650829b..4d06712ee0e8 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/history/HistoryViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/history/HistoryViewModel.kt @@ -7,9 +7,9 @@ import androidx.lifecycle.LifecycleRegistry import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModel -import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode import org.wordpress.android.R @@ -18,10 +18,12 @@ import org.wordpress.android.fluxc.generated.PostActionBuilder import org.wordpress.android.fluxc.model.PostModel import org.wordpress.android.fluxc.model.SiteModel import org.wordpress.android.fluxc.model.revisions.RevisionModel +import org.wordpress.android.fluxc.store.PostStore import org.wordpress.android.fluxc.store.PostStore.FetchRevisionsPayload import org.wordpress.android.fluxc.store.PostStore.OnRevisionsFetched import org.wordpress.android.models.Person -import org.wordpress.android.modules.UI_SCOPE +import org.wordpress.android.modules.BG_THREAD +import org.wordpress.android.modules.UI_THREAD import org.wordpress.android.ui.history.HistoryListItem import org.wordpress.android.ui.history.HistoryListItem.Revision import org.wordpress.android.ui.people.utils.PeopleUtils @@ -30,6 +32,7 @@ import org.wordpress.android.util.AppLog import org.wordpress.android.util.AppLog.T import org.wordpress.android.util.NetworkUtilsWrapper import org.wordpress.android.viewmodel.ResourceProvider +import org.wordpress.android.viewmodel.ScopedViewModel import org.wordpress.android.viewmodel.SingleLiveEvent import org.wordpress.android.viewmodel.helpers.ConnectionStatus import org.wordpress.android.viewmodel.helpers.ConnectionStatus.AVAILABLE @@ -40,9 +43,11 @@ class HistoryViewModel @Inject constructor( private val dispatcher: Dispatcher, private val resourceProvider: ResourceProvider, private val networkUtils: NetworkUtilsWrapper, - @param:Named(UI_SCOPE) private val uiScope: CoroutineScope, + private val postStore: PostStore, + @Named(UI_THREAD) uiDispatcher: CoroutineDispatcher, + @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher, connectionStatus: LiveData -) : ViewModel(), LifecycleOwner { +) : ScopedViewModel(uiDispatcher), LifecycleOwner { enum class HistoryListStatus { DONE, ERROR, @@ -65,9 +70,11 @@ class HistoryViewModel @Inject constructor( private var isStarted = false lateinit var revisionsList: ArrayList - lateinit var post: PostModel lateinit var site: SiteModel + private val _post = MutableLiveData() + val post: LiveData = _post + private val lifecycleRegistry = LifecycleRegistry(this) override fun getLifecycle(): Lifecycle = lifecycleRegistry @@ -81,15 +88,18 @@ class HistoryViewModel @Inject constructor( }) } - fun create(post: PostModel, site: SiteModel) { + fun create(localPostId: Int, site: SiteModel) = launch { if (isStarted) { - return + return@launch } - this.revisionsList = ArrayList() - this.post = post - this.site = site - this._revisions.value = emptyList() + val post: PostModel? = withContext(bgDispatcher) { postStore.getPostByLocalPostId(localPostId) } + + revisionsList = ArrayList() + _revisions.value = emptyList() + + this@HistoryViewModel._post.value = post + this@HistoryViewModel.site = site fetchRevisions() @@ -107,7 +117,10 @@ class HistoryViewModel @Inject constructor( revisionAuthorsId = ArrayList(revisionAuthorsId.distinct()) _revisions.value = getHistoryListItemsFromRevisionModels(revisions) - fetchRevisionAuthorDetails(revisionAuthorsId) + + if (revisionAuthorsId.isNotEmpty()) { + fetchRevisionAuthorDetails(revisionAuthorsId) + } } private fun fetchRevisionAuthorDetails(authorsId: List) { @@ -147,10 +160,17 @@ class HistoryViewModel @Inject constructor( } private fun fetchRevisions() { - _listStatus.value = HistoryListStatus.FETCHING - val payload = FetchRevisionsPayload(post, site) - uiScope.launch { - dispatcher.dispatch(PostActionBuilder.newFetchRevisionsAction(payload)) + val post = this.post.value + + if (post != null) { + _listStatus.value = HistoryListStatus.FETCHING + val payload = FetchRevisionsPayload(post, site) + launch { + dispatcher.dispatch(PostActionBuilder.newFetchRevisionsAction(payload)) + } + } else { + _listStatus.value = HistoryListStatus.DONE + createRevisionsList(emptyList()) } } @@ -171,7 +191,7 @@ class HistoryViewModel @Inject constructor( if (revisions.isNotEmpty()) { val last = items.last() as Revision - val footer = if (post.isPage) { + val footer = if (post.value?.isPage == true) { resourceProvider.getString(R.string.history_footer_page, last.formattedDate, last.formattedTime) } else { resourceProvider.getString(R.string.history_footer_post, last.formattedDate, last.formattedTime) diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListItemUiStateHelper.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListItemUiStateHelper.kt index e3737ff40ec6..2850cf833c2f 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListItemUiStateHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListItemUiStateHelper.kt @@ -4,7 +4,6 @@ import androidx.annotation.ColorRes import org.apache.commons.text.StringEscapeUtils import org.wordpress.android.BuildConfig import org.wordpress.android.R -import org.wordpress.android.R.string import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.analytics.AnalyticsTracker.Stat.POST_LIST_BUTTON_PRESSED import org.wordpress.android.analytics.AnalyticsTracker.Stat.POST_LIST_ITEM_SELECTED @@ -48,7 +47,7 @@ import javax.inject.Inject private const val MAX_NUMBER_OF_VISIBLE_ACTIONS_STANDARD = 3 const val ERROR_COLOR = R.color.error -const val PROGRESS_INFO_COLOR = R.color.neutral_500 +const val PROGRESS_INFO_COLOR = R.color.neutral_50 const val STATE_INFO_COLOR = R.color.warning_dark /** @@ -209,10 +208,10 @@ class PostListItemUiStateHelper @Inject constructor(private val appPrefsWrapper: private fun getErrorLabel(uploadError: UploadError, postStatus: PostStatus): UiString? { return when { uploadError.mediaError != null -> when (postStatus) { - PRIVATE, PUBLISHED -> UiStringRes(string.error_media_recover_post_not_published) - SCHEDULED -> UiStringRes(string.error_media_recover_post_not_scheduled) - PENDING -> UiStringRes(string.error_media_recover_post_not_submitted) - DRAFT, TRASHED, UNKNOWN -> UiStringRes(string.error_media_recover_post) + PRIVATE, PUBLISHED -> UiStringRes(R.string.error_media_recover_post_not_published) + SCHEDULED -> UiStringRes(R.string.error_media_recover_post_not_scheduled) + PENDING -> UiStringRes(R.string.error_media_recover_post_not_submitted) + DRAFT, TRASHED, UNKNOWN -> UiStringRes(R.string.error_media_recover_post) } uploadError.postError != null -> UploadUtils.getErrorMessageResIdFromPostError( false, @@ -267,9 +266,11 @@ class PostListItemUiStateHelper @Inject constructor(private val appPrefsWrapper: ): List { val canRetryUpload = uploadUiState is PostUploadUiState.UploadFailed val canPublishPost = (canRetryUpload || uploadUiState is NothingToUpload) && - (isLocallyChanged || isLocalDraft || postStatus == PostStatus.DRAFT) + (isLocallyChanged || isLocalDraft || postStatus == DRAFT || + (siteHasCapabilitiesToPublish && postStatus == PENDING)) + val canShowStats = statsSupported && - postStatus == PostStatus.PUBLISHED && + postStatus == PUBLISHED && !isLocalDraft && !isLocallyChanged val canShowViewButton = !canRetryUpload @@ -279,10 +280,10 @@ class PostListItemUiStateHelper @Inject constructor(private val appPrefsWrapper: buttonTypes.add(BUTTON_EDIT) if (canShowPublishButton) { buttonTypes.add( - if (!siteHasCapabilitiesToPublish) { - BUTTON_SUBMIT - } else if (canRetryUpload) { + if (canRetryUpload) { BUTTON_RETRY + } else if (!siteHasCapabilitiesToPublish) { + BUTTON_SUBMIT } else if (postStatus == SCHEDULED && isLocallyChanged) { BUTTON_SYNC } else { @@ -303,11 +304,11 @@ class PostListItemUiStateHelper @Inject constructor(private val appPrefsWrapper: when { isLocalDraft -> buttonTypes.add(PostListButtonType.BUTTON_DELETE) - postStatus == PostStatus.TRASHED -> { + postStatus == TRASHED -> { buttonTypes.add(PostListButtonType.BUTTON_DELETE) buttonTypes.add(PostListButtonType.BUTTON_MOVE_TO_DRAFT) } - postStatus != PostStatus.TRASHED -> buttonTypes.add(PostListButtonType.BUTTON_TRASH) + postStatus != TRASHED -> buttonTypes.add(PostListButtonType.BUTTON_TRASH) } if (canShowStats) { @@ -363,7 +364,7 @@ class PostListItemUiStateHelper @Inject constructor(private val appPrefsWrapper: ): PostUploadUiState { return when { uploadStatus.hasInProgressMediaUpload -> UploadingMedia(uploadStatus.mediaUploadProgress) - uploadStatus.isUploading -> UploadingPost(postStatus == PostStatus.DRAFT) + uploadStatus.isUploading -> UploadingPost(postStatus == DRAFT) // the upload error is not null on retry -> it needs to be evaluated after UploadingMedia and UploadingPost uploadStatus.uploadError != null -> PostUploadUiState.UploadFailed(uploadStatus.uploadError) uploadStatus.hasPendingMediaUpload || diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt index ffc9f744e0d9..d9cea21ae24f 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModel.kt @@ -34,6 +34,7 @@ import org.wordpress.android.ui.posts.AuthorFilterSelection.ME import org.wordpress.android.ui.posts.PostListType.SEARCH import org.wordpress.android.ui.posts.PostUtils import org.wordpress.android.ui.posts.trackPostListAction +import org.wordpress.android.ui.reader.utils.ReaderUtilsWrapper import org.wordpress.android.ui.uploads.UploadStarter import org.wordpress.android.util.AppLog import org.wordpress.android.util.NetworkUtilsWrapper @@ -47,6 +48,7 @@ import org.wordpress.android.viewmodel.posts.PostListItemIdentifier.LocalPostId import org.wordpress.android.viewmodel.posts.PostListItemType.PostListItemUiState import javax.inject.Inject import javax.inject.Named +import kotlin.properties.Delegates typealias PagedPostList = PagedList @@ -63,6 +65,7 @@ class PostListViewModel @Inject constructor( private val listItemUiStateHelper: PostListItemUiStateHelper, private val networkUtilsWrapper: NetworkUtilsWrapper, private val uploadStarter: UploadStarter, + private val readerUtilsWrapper: ReaderUtilsWrapper, @Named(UI_THREAD) private val uiDispatcher: CoroutineDispatcher, @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher, connectionStatus: LiveData @@ -73,6 +76,9 @@ class PostListViewModel @Inject constructor( private var isStarted: Boolean = false private lateinit var connector: PostListViewModelConnector + private var photonWidth by Delegates.notNull() + private var photonHeight by Delegates.notNull() + private var scrollToLocalPostId: LocalPostId? = null private val _scrollToPosition = SingleLiveEvent() @@ -113,10 +119,16 @@ class PostListViewModel @Inject constructor( private val lifecycleRegistry = LifecycleRegistry(this) override fun getLifecycle(): Lifecycle = lifecycleRegistry - fun start(postListViewModelConnector: PostListViewModelConnector) { + fun start( + postListViewModelConnector: PostListViewModelConnector, + photonWidth: Int, + photonHeight: Int + ) { if (isStarted) { return } + this.photonHeight = photonHeight + this.photonWidth = photonWidth connector = postListViewModelConnector if (connector.postListType != SEARCH) { @@ -337,10 +349,8 @@ class PostListViewModel @Inject constructor( unhandledConflicts = connector.doesPostHaveUnhandledConflict(post), capabilitiesToPublish = connector.site.hasCapabilityPublishPosts, statsSupported = isStatsSupported, - featuredImageUrl = connector.getFeaturedImageUrl( - post.featuredImageId, - post.content - ), + featuredImageUrl = + convertToPhotonUrlIfPossible(connector.getFeaturedImageUrl(post.featuredImageId)), formattedDate = PostUtils.getFormattedDate(post), performingCriticalAction = connector.postActionHandler.isPerformingCriticalAction(LocalId(post.id)), onAction = { postModel, buttonType, statEvent -> @@ -357,4 +367,12 @@ class PostListViewModel @Inject constructor( fetchFirstPage() } } + + private fun convertToPhotonUrlIfPossible(featuredImageUrl: String?): String? = + readerUtilsWrapper.getResizedImageUrl( + featuredImageUrl, + photonWidth, + photonHeight, + !SiteUtils.isPhotonCapable(connector.site) + ) } diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModelConnector.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModelConnector.kt index 4cb3604e6f08..256732f33900 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModelConnector.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/posts/PostListViewModelConnector.kt @@ -14,9 +14,9 @@ class PostListViewModelConnector( val getUploadStatus: (PostModel) -> PostListItemUploadStatus, val doesPostHaveUnhandledConflict: (PostModel) -> Boolean, val postFetcher: PostFetcher, - private val getFeaturedImageUrl: (site: SiteModel, featuredImageId: Long, postContent: String) -> String? + private val getFeaturedImageUrl: (site: SiteModel, featuredImageId: Long) -> String? ) { - fun getFeaturedImageUrl(featuredImageId: Long, postContent: String): String? { - return getFeaturedImageUrl.invoke(site, featuredImageId, postContent) + fun getFeaturedImageUrl(featuredImageId: Long): String? { + return getFeaturedImageUrl.invoke(site, featuredImageId) } } diff --git a/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt b/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt index c93de6c66879..be1c78339597 100644 --- a/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt +++ b/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt @@ -12,18 +12,18 @@ enum class PostListButtonType constructor( @DrawableRes val iconResId: Int, @ColorRes val colorResId: Int ) { - BUTTON_EDIT(1, R.string.button_edit, R.drawable.ic_pencil_white_24dp, R.color.neutral_500), - BUTTON_VIEW(2, R.string.button_view, R.drawable.ic_external_white_24dp, R.color.neutral_500), - BUTTON_PREVIEW(3, R.string.button_preview, R.drawable.ic_external_white_24dp, R.color.neutral_500), - BUTTON_STATS(4, R.string.button_stats, R.drawable.ic_stats_alt_white_24dp, R.color.neutral_500), - BUTTON_TRASH(5, R.string.button_trash, R.drawable.ic_trash_white_24dp, R.color.neutral_500), - BUTTON_DELETE(6, R.string.button_delete, R.drawable.ic_trash_white_24dp, R.color.neutral_500), - BUTTON_PUBLISH(7, R.string.button_publish, R.drawable.ic_reader_white_24dp, R.color.neutral_500), - BUTTON_SYNC(8, R.string.button_sync, R.drawable.ic_reader_white_24dp, R.color.neutral_500), - BUTTON_MORE(9, R.string.button_more, R.drawable.ic_ellipsis_white_24dp, R.color.neutral_500), - BUTTON_SUBMIT(10, R.string.submit_for_review, R.drawable.ic_reader_white_24dp, R.color.neutral_500), + BUTTON_EDIT(1, R.string.button_edit, R.drawable.ic_pencil_white_24dp, R.color.neutral_50), + BUTTON_VIEW(2, R.string.button_view, R.drawable.ic_external_white_24dp, R.color.neutral_50), + BUTTON_PREVIEW(3, R.string.button_preview, R.drawable.ic_external_white_24dp, R.color.neutral_50), + BUTTON_STATS(4, R.string.button_stats, R.drawable.ic_stats_alt_white_24dp, R.color.neutral_50), + BUTTON_TRASH(5, R.string.button_trash, R.drawable.ic_trash_white_24dp, R.color.neutral_50), + BUTTON_DELETE(6, R.string.button_delete, R.drawable.ic_trash_white_24dp, R.color.neutral_50), + BUTTON_PUBLISH(7, R.string.button_publish, R.drawable.ic_reader_white_24dp, R.color.neutral_50), + BUTTON_SYNC(8, R.string.button_sync, R.drawable.ic_reader_white_24dp, R.color.neutral_50), + BUTTON_MORE(9, R.string.button_more, R.drawable.ic_ellipsis_white_24dp, R.color.neutral_50), + BUTTON_SUBMIT(10, R.string.submit_for_review, R.drawable.ic_reader_white_24dp, R.color.neutral_50), BUTTON_RETRY(11, R.string.button_retry, R.drawable.ic_refresh_white_24dp, R.color.error), - BUTTON_MOVE_TO_DRAFT(12, R.string.button_move_to_draft, R.drawable.ic_refresh_white_24dp, R.color.neutral_500); + BUTTON_MOVE_TO_DRAFT(12, R.string.button_move_to_draft, R.drawable.ic_refresh_white_24dp, R.color.neutral_50); companion object { fun fromInt(value: Int): PostListButtonType? = values().firstOrNull { it.value == value } diff --git a/WordPress/src/main/res/color/accent_neutral_300_selector.xml b/WordPress/src/main/res/color/accent_neutral_30_selector.xml similarity index 68% rename from WordPress/src/main/res/color/accent_neutral_300_selector.xml rename to WordPress/src/main/res/color/accent_neutral_30_selector.xml index 87dfc7d706e0..660365844919 100644 --- a/WordPress/src/main/res/color/accent_neutral_300_selector.xml +++ b/WordPress/src/main/res/color/accent_neutral_30_selector.xml @@ -3,7 +3,7 @@ - + diff --git a/WordPress/src/main/res/color/black_translucent_50_neutral_700_selector.xml b/WordPress/src/main/res/color/black_translucent_50_neutral_70_selector.xml similarity index 85% rename from WordPress/src/main/res/color/black_translucent_50_neutral_700_selector.xml rename to WordPress/src/main/res/color/black_translucent_50_neutral_70_selector.xml index c6d1934d78d9..3120bcc31a5c 100644 --- a/WordPress/src/main/res/color/black_translucent_50_neutral_700_selector.xml +++ b/WordPress/src/main/res/color/black_translucent_50_neutral_70_selector.xml @@ -4,7 +4,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/WordPress/src/main/res/color/neutral_100_primary_400_selector.xml b/WordPress/src/main/res/color/neutral_10_primary_40_selector.xml similarity index 50% rename from WordPress/src/main/res/color/neutral_100_primary_400_selector.xml rename to WordPress/src/main/res/color/neutral_10_primary_40_selector.xml index 05503ff1ab91..3299f62bdf01 100644 --- a/WordPress/src/main/res/color/neutral_100_primary_400_selector.xml +++ b/WordPress/src/main/res/color/neutral_10_primary_40_selector.xml @@ -3,7 +3,7 @@ - - + + diff --git a/WordPress/src/main/res/color/neutral_700_neutral_200_selector.xml b/WordPress/src/main/res/color/neutral_70_neutral_20_selector.xml similarity index 50% rename from WordPress/src/main/res/color/neutral_700_neutral_200_selector.xml rename to WordPress/src/main/res/color/neutral_70_neutral_20_selector.xml index 630b527023df..c28163dff60f 100644 --- a/WordPress/src/main/res/color/neutral_700_neutral_200_selector.xml +++ b/WordPress/src/main/res/color/neutral_70_neutral_20_selector.xml @@ -3,7 +3,7 @@ - - + + diff --git a/WordPress/src/main/res/color/neutral_accent_neutral_400_selector.xml b/WordPress/src/main/res/color/neutral_accent_neutral_40_selector.xml similarity index 55% rename from WordPress/src/main/res/color/neutral_accent_neutral_400_selector.xml rename to WordPress/src/main/res/color/neutral_accent_neutral_40_selector.xml index 4248f6a9d3fa..24bd3120b7b9 100644 --- a/WordPress/src/main/res/color/neutral_accent_neutral_400_selector.xml +++ b/WordPress/src/main/res/color/neutral_accent_neutral_40_selector.xml @@ -3,8 +3,8 @@ - - + + diff --git a/WordPress/src/main/res/color/neutral_neutral_200_selector.xml b/WordPress/src/main/res/color/neutral_neutral_20_selector.xml similarity index 68% rename from WordPress/src/main/res/color/neutral_neutral_200_selector.xml rename to WordPress/src/main/res/color/neutral_neutral_20_selector.xml index 95a280471d9e..bb8358016d3c 100644 --- a/WordPress/src/main/res/color/neutral_neutral_200_selector.xml +++ b/WordPress/src/main/res/color/neutral_neutral_20_selector.xml @@ -3,7 +3,7 @@ - + diff --git a/WordPress/src/main/res/color/neutral_primary_400_neutral_400_selector.xml b/WordPress/src/main/res/color/neutral_primary_40_neutral_40_selector.xml similarity index 52% rename from WordPress/src/main/res/color/neutral_primary_400_neutral_400_selector.xml rename to WordPress/src/main/res/color/neutral_primary_40_neutral_40_selector.xml index d2e316574c3a..26f301e9afe0 100644 --- a/WordPress/src/main/res/color/neutral_primary_400_neutral_400_selector.xml +++ b/WordPress/src/main/res/color/neutral_primary_40_neutral_40_selector.xml @@ -3,8 +3,8 @@ - - + + diff --git a/WordPress/src/main/res/color/primary_400_gray_200_gray_400_selector.xml b/WordPress/src/main/res/color/primary_400_gray_200_gray_400_selector.xml deleted file mode 100644 index f712833b1c86..000000000000 --- a/WordPress/src/main/res/color/primary_400_gray_200_gray_400_selector.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/WordPress/src/main/res/color/primary_400_gray_900_gray_500_selector.xml b/WordPress/src/main/res/color/primary_400_gray_900_gray_500_selector.xml deleted file mode 100644 index 54e62a8943eb..000000000000 --- a/WordPress/src/main/res/color/primary_400_gray_900_gray_500_selector.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/WordPress/src/main/res/color/primary_40_gray_20_gray_40_selector.xml b/WordPress/src/main/res/color/primary_40_gray_20_gray_40_selector.xml new file mode 100644 index 000000000000..546cf71d2a8b --- /dev/null +++ b/WordPress/src/main/res/color/primary_40_gray_20_gray_40_selector.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/WordPress/src/main/res/color/primary_40_gray_90_gray_50_selector.xml b/WordPress/src/main/res/color/primary_40_gray_90_gray_50_selector.xml new file mode 100644 index 000000000000..c54edf201e71 --- /dev/null +++ b/WordPress/src/main/res/color/primary_40_gray_90_gray_50_selector.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/WordPress/src/main/res/color/primary_400_neutral_400_selector.xml b/WordPress/src/main/res/color/primary_40_neutral_40_selector.xml similarity index 50% rename from WordPress/src/main/res/color/primary_400_neutral_400_selector.xml rename to WordPress/src/main/res/color/primary_40_neutral_40_selector.xml index 7c3c02fe6f42..4f47ee710726 100644 --- a/WordPress/src/main/res/color/primary_400_neutral_400_selector.xml +++ b/WordPress/src/main/res/color/primary_40_neutral_40_selector.xml @@ -3,7 +3,7 @@ - - + + diff --git a/WordPress/src/main/res/color/quick_start_icon_selector.xml b/WordPress/src/main/res/color/quick_start_icon_selector.xml index 630b527023df..c28163dff60f 100644 --- a/WordPress/src/main/res/color/quick_start_icon_selector.xml +++ b/WordPress/src/main/res/color/quick_start_icon_selector.xml @@ -3,7 +3,7 @@ - - + + diff --git a/WordPress/src/main/res/color/quick_start_title_selector.xml b/WordPress/src/main/res/color/quick_start_title_selector.xml index e98497486ade..d4971f7570dd 100644 --- a/WordPress/src/main/res/color/quick_start_title_selector.xml +++ b/WordPress/src/main/res/color/quick_start_title_selector.xml @@ -3,7 +3,7 @@ - - + + diff --git a/WordPress/src/main/res/color/related_posts_preview_header.xml b/WordPress/src/main/res/color/related_posts_preview_header.xml index fd2228af3fc3..bffc2159c2a2 100644 --- a/WordPress/src/main/res/color/related_posts_preview_header.xml +++ b/WordPress/src/main/res/color/related_posts_preview_header.xml @@ -4,10 +4,10 @@ xmlns:android="http://schemas.android.com/apk/res/android"> + android:color="@color/neutral_10" /> diff --git a/WordPress/src/main/res/color/stats_block_column.xml b/WordPress/src/main/res/color/stats_block_column.xml index 77e6e1bf4ee6..2be3d7b77c2d 100644 --- a/WordPress/src/main/res/color/stats_block_column.xml +++ b/WordPress/src/main/res/color/stats_block_column.xml @@ -4,13 +4,13 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/WordPress/src/main/res/color/white_neutral_100_selector.xml b/WordPress/src/main/res/color/white_neutral_10_selector.xml similarity index 68% rename from WordPress/src/main/res/color/white_neutral_100_selector.xml rename to WordPress/src/main/res/color/white_neutral_10_selector.xml index 0cff67e58b1c..7a3383914ac6 100644 --- a/WordPress/src/main/res/color/white_neutral_100_selector.xml +++ b/WordPress/src/main/res/color/white_neutral_10_selector.xml @@ -1,5 +1,5 @@ - + diff --git a/WordPress/src/main/res/drawable-anydpi-v26/ic_shortcut_create_post.xml b/WordPress/src/main/res/drawable-anydpi-v26/ic_shortcut_create_post.xml index fbeb4bcb192e..581090a2865d 100644 --- a/WordPress/src/main/res/drawable-anydpi-v26/ic_shortcut_create_post.xml +++ b/WordPress/src/main/res/drawable-anydpi-v26/ic_shortcut_create_post.xml @@ -1,6 +1,6 @@ - + - + - + diff --git a/WordPress/src/main/res/drawable/bg_oval_error_500.xml b/WordPress/src/main/res/drawable/bg_oval_error_50.xml similarity index 83% rename from WordPress/src/main/res/drawable/bg_oval_error_500.xml rename to WordPress/src/main/res/drawable/bg_oval_error_50.xml index 0565b056e0a4..814fc526126e 100644 --- a/WordPress/src/main/res/drawable/bg_oval_error_500.xml +++ b/WordPress/src/main/res/drawable/bg_oval_error_50.xml @@ -3,5 +3,5 @@ xmlns:tools="http://schemas.android.com/tools" android:shape="oval" tools:ignore="UnusedResources"> - + diff --git a/WordPress/src/main/res/drawable/bg_oval_error_500_minus_white_16dp.xml b/WordPress/src/main/res/drawable/bg_oval_error_50_minus_white_16dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_error_500_minus_white_16dp.xml rename to WordPress/src/main/res/drawable/bg_oval_error_50_minus_white_16dp.xml index 9220844f722d..c6fc8f47e686 100644 --- a/WordPress/src/main/res/drawable/bg_oval_error_500_minus_white_16dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_error_50_minus_white_16dp.xml @@ -8,7 +8,7 @@ android:shape="oval" > + android:color="@color/error_50" > diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_200_stroke_white.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_20_stroke_white.xml similarity index 86% rename from WordPress/src/main/res/drawable/bg_oval_neutral_200_stroke_white.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_20_stroke_white.xml index 4e8a358c86ea..650e09346b11 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_200_stroke_white.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_20_stroke_white.xml @@ -10,7 +10,7 @@ + android:color="@color/neutral_20"> diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_500.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_30.xml similarity index 82% rename from WordPress/src/main/res/drawable/bg_oval_primary_500.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_30.xml index 1481523c541b..7ff616c4ff4c 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_500.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_30.xml @@ -3,5 +3,5 @@ xmlns:tools="http://schemas.android.com/tools" android:shape="oval" tools:ignore="UnusedResources"> - + diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_30_customize_white_40dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_30_customize_white_40dp.xml index 4ea86de78945..350333b14fac 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_30_customize_white_40dp.xml @@ -10,7 +10,7 @@ android:shape="oval" > + android:color="@color/neutral_30" > diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_300_multiple_users_white_40dp.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_30_multiple_users_white_40dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_neutral_300_multiple_users_white_40dp.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_30_multiple_users_white_40dp.xml index 7b481226495b..f0f0fd5ebce8 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_300_multiple_users_white_40dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_30_multiple_users_white_40dp.xml @@ -7,7 +7,7 @@ android:shape="oval"> + android:color="@color/neutral_30" > diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_300_plans_32dp.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_30_plans_32dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_neutral_300_plans_32dp.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_30_plans_32dp.xml index 9c5fab8a9968..9074fbb23d0a 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_300_plans_32dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_30_plans_32dp.xml @@ -8,7 +8,7 @@ android:shape="oval"> + android:color="@color/neutral_30" > diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_300_user_32dp.xml b/WordPress/src/main/res/drawable/bg_oval_neutral_30_user_32dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_neutral_300_user_32dp.xml rename to WordPress/src/main/res/drawable/bg_oval_neutral_30_user_32dp.xml index e9080ddd1673..76c73afe9439 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_300_user_32dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_neutral_30_user_32dp.xml @@ -8,7 +8,7 @@ android:shape="oval"> + android:color="@color/neutral_30" > diff --git a/WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp_selector.xml b/WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp_selector.xml deleted file mode 100644 index a02ecd8f3038..000000000000 --- a/WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp_selector.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - diff --git a/WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp.xml b/WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp.xml similarity index 90% rename from WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp.xml rename to WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp.xml index 14911dfa43a4..f95ecf3a40e3 100644 --- a/WordPress/src/main/res/drawable/bg_oval_pink_500_multiple_users_white_40dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp.xml @@ -8,7 +8,7 @@ android:shape="oval" > + android:color="@color/pink_50" > diff --git a/WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp_selector.xml b/WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp_selector.xml new file mode 100644 index 000000000000..7e81acd650a5 --- /dev/null +++ b/WordPress/src/main/res/drawable/bg_oval_pink_50_multiple_users_white_40dp_selector.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_100.xml b/WordPress/src/main/res/drawable/bg_oval_primary_10.xml similarity index 77% rename from WordPress/src/main/res/drawable/bg_oval_primary_100.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_10.xml index e2b6e3a65c0b..598479cd152b 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_100.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_10.xml @@ -2,5 +2,5 @@ + android:color="@color/primary_10"/> diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_400.xml b/WordPress/src/main/res/drawable/bg_oval_primary_40.xml similarity index 73% rename from WordPress/src/main/res/drawable/bg_oval_primary_400.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_40.xml index ef3990854c92..39ae2179a5f8 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_400.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_40.xml @@ -1,4 +1,4 @@ - + diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp_selector.xml b/WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp_selector.xml deleted file mode 100644 index 2934b9ad5759..000000000000 --- a/WordPress/src/main/res/drawable/bg_oval_primary_400_customize_white_40dp_selector.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_300_customize_white_40dp.xml b/WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_neutral_300_customize_white_40dp.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp.xml index c1688943866d..1aa456c25b09 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_300_customize_white_40dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp.xml @@ -10,7 +10,7 @@ android:shape="oval" > + android:color="@color/primary_40" > diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp_selector.xml b/WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp_selector.xml new file mode 100644 index 000000000000..fc09dab1fb54 --- /dev/null +++ b/WordPress/src/main/res/drawable/bg_oval_primary_40_customize_white_40dp_selector.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_400_stroke_notification_unread.xml b/WordPress/src/main/res/drawable/bg_oval_primary_40_stroke_notification_unread.xml similarity index 86% rename from WordPress/src/main/res/drawable/bg_oval_primary_400_stroke_notification_unread.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_40_stroke_notification_unread.xml index e4bb6103b72a..aabc1a7fe049 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_400_stroke_notification_unread.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_40_stroke_notification_unread.xml @@ -10,7 +10,7 @@ + android:color="@color/primary_40"> diff --git a/WordPress/src/main/res/drawable/bg_oval_success_500.xml b/WordPress/src/main/res/drawable/bg_oval_primary_50.xml similarity index 82% rename from WordPress/src/main/res/drawable/bg_oval_success_500.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_50.xml index 421c1c27d170..5e8aed16a1f3 100644 --- a/WordPress/src/main/res/drawable/bg_oval_success_500.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_50.xml @@ -3,5 +3,5 @@ xmlns:tools="http://schemas.android.com/tools" android:shape="oval" tools:ignore="UnusedResources"> - + diff --git a/WordPress/src/main/res/drawable/bg_oval_primary_500_plus_white_16dp.xml b/WordPress/src/main/res/drawable/bg_oval_primary_50_plus_white_16dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_oval_primary_500_plus_white_16dp.xml rename to WordPress/src/main/res/drawable/bg_oval_primary_50_plus_white_16dp.xml index fb5a876d29c1..d0a84324bcd1 100644 --- a/WordPress/src/main/res/drawable/bg_oval_primary_500_plus_white_16dp.xml +++ b/WordPress/src/main/res/drawable/bg_oval_primary_50_plus_white_16dp.xml @@ -8,7 +8,7 @@ android:shape="oval" > + android:color="@color/primary_50" > diff --git a/WordPress/src/main/res/drawable/bg_oval_neutral_300.xml b/WordPress/src/main/res/drawable/bg_oval_success_50.xml similarity index 82% rename from WordPress/src/main/res/drawable/bg_oval_neutral_300.xml rename to WordPress/src/main/res/drawable/bg_oval_success_50.xml index 72b5eeaf5b13..812e9fc34284 100644 --- a/WordPress/src/main/res/drawable/bg_oval_neutral_300.xml +++ b/WordPress/src/main/res/drawable/bg_oval_success_50.xml @@ -3,5 +3,5 @@ xmlns:tools="http://schemas.android.com/tools" android:shape="oval" tools:ignore="UnusedResources"> - + diff --git a/WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_50_accent.xml b/WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_5_accent.xml similarity index 87% rename from WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_50_accent.xml rename to WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_5_accent.xml index 48e3791e3099..2ac263a3a391 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_50_accent.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_gradient_accent_5_accent.xml @@ -5,7 +5,7 @@ + android:startColor="@color/primary_50"> diff --git a/WordPress/src/main/res/drawable/bg_rectangle_gray_700_top_radius_4dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_gray_700_top_radius_4dp.xml index 266d8ee7264c..c59c64b8d854 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_gray_700_top_radius_4dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_gray_700_top_radius_4dp.xml @@ -2,7 +2,7 @@ - + diff --git a/WordPress/src/main/res/drawable/bg_rectangle_gray_800_radius_4dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_gray_800_radius_4dp.xml index 2859748d1f82..ee8c8beb98f9 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_gray_800_radius_4dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_gray_800_radius_4dp.xml @@ -2,6 +2,6 @@ - + diff --git a/WordPress/src/main/res/drawable/bg_rectangle_neutral_100_globe_32dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_neutral_10_globe_32dp.xml similarity index 89% rename from WordPress/src/main/res/drawable/bg_rectangle_neutral_100_globe_32dp.xml rename to WordPress/src/main/res/drawable/bg_rectangle_neutral_10_globe_32dp.xml index d3e36260f4bf..4f6862b30514 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_neutral_100_globe_32dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_neutral_10_globe_32dp.xml @@ -8,7 +8,7 @@ android:shape="rectangle"> + android:color="@color/neutral_10" > diff --git a/WordPress/src/main/res/drawable/bg_rectangle_neutral_100_themes_100dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_neutral_10_themes_100dp.xml similarity index 90% rename from WordPress/src/main/res/drawable/bg_rectangle_neutral_100_themes_100dp.xml rename to WordPress/src/main/res/drawable/bg_rectangle_neutral_10_themes_100dp.xml index 0dcfa3744b45..e361ad78df58 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_neutral_100_themes_100dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_neutral_10_themes_100dp.xml @@ -9,7 +9,7 @@ android:shape="rectangle" > + android:color="@color/neutral_10" > + android:color="@color/neutral_10" > diff --git a/WordPress/src/main/res/drawable/bg_rectangle_primary_700_16dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_primary_70_16dp.xml similarity index 80% rename from WordPress/src/main/res/drawable/bg_rectangle_primary_700_16dp.xml rename to WordPress/src/main/res/drawable/bg_rectangle_primary_70_16dp.xml index 45ce82871c58..acc6cdf8d134 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_primary_700_16dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_primary_70_16dp.xml @@ -1,5 +1,5 @@ - + diff --git a/WordPress/src/main/res/drawable/bg_rectangle_red_500_radius_2dp.xml b/WordPress/src/main/res/drawable/bg_rectangle_red_50_radius_2dp.xml similarity index 85% rename from WordPress/src/main/res/drawable/bg_rectangle_red_500_radius_2dp.xml rename to WordPress/src/main/res/drawable/bg_rectangle_red_50_radius_2dp.xml index b4ac5cf35e25..8adc101d2fd2 100644 --- a/WordPress/src/main/res/drawable/bg_rectangle_red_500_radius_2dp.xml +++ b/WordPress/src/main/res/drawable/bg_rectangle_red_50_radius_2dp.xml @@ -5,7 +5,7 @@ android:shape="rectangle"> + android:color="@color/red_50"> + android:color="@color/primary_5"> diff --git a/WordPress/src/main/res/drawable/blavatar_border.xml b/WordPress/src/main/res/drawable/blavatar_border.xml index 7ca61ee1a764..96818bc142b2 100644 --- a/WordPress/src/main/res/drawable/blavatar_border.xml +++ b/WordPress/src/main/res/drawable/blavatar_border.xml @@ -2,7 +2,7 @@ + android:color="@color/neutral_10"/> diff --git a/WordPress/src/main/res/drawable/button_frame.xml b/WordPress/src/main/res/drawable/button_frame.xml index 32c27c98f0f3..b91c703cce38 100644 --- a/WordPress/src/main/res/drawable/button_frame.xml +++ b/WordPress/src/main/res/drawable/button_frame.xml @@ -4,8 +4,8 @@ - + android:color="@color/neutral_30"/> + @@ -13,7 +13,7 @@ + android:color="@color/neutral_10"/> diff --git a/WordPress/src/main/res/drawable/ic_add_outline_grey_dark_24dp.xml b/WordPress/src/main/res/drawable/ic_add_outline_grey_dark_24dp.xml index 63c024f46e72..a10225bcb869 100644 --- a/WordPress/src/main/res/drawable/ic_add_outline_grey_dark_24dp.xml +++ b/WordPress/src/main/res/drawable/ic_add_outline_grey_dark_24dp.xml @@ -4,7 +4,7 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/WordPress/src/main/res/drawable/ic_bookmark_grey_dark_18dp.xml b/WordPress/src/main/res/drawable/ic_bookmark_grey_dark_18dp.xml index f75637ec429c..a7e70aa330cc 100644 --- a/WordPress/src/main/res/drawable/ic_bookmark_grey_dark_18dp.xml +++ b/WordPress/src/main/res/drawable/ic_bookmark_grey_dark_18dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="24" > diff --git a/WordPress/src/main/res/drawable/ic_create_blue_wordpress_48dp.xml b/WordPress/src/main/res/drawable/ic_create_blue_wordpress_48dp.xml index 95ba462fa1c8..d9cd7d725dfb 100644 --- a/WordPress/src/main/res/drawable/ic_create_blue_wordpress_48dp.xml +++ b/WordPress/src/main/res/drawable/ic_create_blue_wordpress_48dp.xml @@ -6,12 +6,12 @@ android:viewportWidth="48" > diff --git a/WordPress/src/main/res/drawable/ic_dropdown_blue_light_24dp.xml b/WordPress/src/main/res/drawable/ic_dropdown_primary_30_24dp.xml similarity index 85% rename from WordPress/src/main/res/drawable/ic_dropdown_blue_light_24dp.xml rename to WordPress/src/main/res/drawable/ic_dropdown_primary_30_24dp.xml index a5c72545691c..41dda10a6cb0 100644 --- a/WordPress/src/main/res/drawable/ic_dropdown_blue_light_24dp.xml +++ b/WordPress/src/main/res/drawable/ic_dropdown_primary_30_24dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="24.0" > diff --git a/WordPress/src/main/res/drawable/ic_info_outline_grey_dark_18dp.xml b/WordPress/src/main/res/drawable/ic_info_outline_grey_dark_18dp.xml index 8826aca369f2..8c0ef56c8e95 100644 --- a/WordPress/src/main/res/drawable/ic_info_outline_grey_dark_18dp.xml +++ b/WordPress/src/main/res/drawable/ic_info_outline_grey_dark_18dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="18.0" > diff --git a/WordPress/src/main/res/drawable/ic_send_accent_neutral_300_24dp.xml b/WordPress/src/main/res/drawable/ic_send_accent_neutral_30_24dp.xml similarity index 82% rename from WordPress/src/main/res/drawable/ic_send_accent_neutral_300_24dp.xml rename to WordPress/src/main/res/drawable/ic_send_accent_neutral_30_24dp.xml index 36d8981670d0..aff28f01a068 100644 --- a/WordPress/src/main/res/drawable/ic_send_accent_neutral_300_24dp.xml +++ b/WordPress/src/main/res/drawable/ic_send_accent_neutral_30_24dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="24.0" > diff --git a/WordPress/src/main/res/drawable/ic_stats_alt_blue_wordpress_48dp.xml b/WordPress/src/main/res/drawable/ic_stats_alt_blue_wordpress_48dp.xml index 33f385d1b00f..7b42dd2499f3 100644 --- a/WordPress/src/main/res/drawable/ic_stats_alt_blue_wordpress_48dp.xml +++ b/WordPress/src/main/res/drawable/ic_stats_alt_blue_wordpress_48dp.xml @@ -6,7 +6,7 @@ android:viewportWidth="48" > diff --git a/WordPress/src/main/res/drawable/img_confetti_284dp.xml b/WordPress/src/main/res/drawable/img_confetti_284dp.xml index 408f98ed5d9d..54d66bfde038 100644 --- a/WordPress/src/main/res/drawable/img_confetti_284dp.xml +++ b/WordPress/src/main/res/drawable/img_confetti_284dp.xml @@ -10,22 +10,22 @@ tools:ignore="VectorRaster"> @@ -35,7 +35,7 @@ @@ -45,7 +45,7 @@ @@ -55,7 +55,7 @@ @@ -65,42 +65,42 @@ diff --git a/WordPress/src/main/res/drawable/img_giphy_100dp.xml b/WordPress/src/main/res/drawable/img_giphy_100dp.xml index 9b3b39970b58..7648c59bbe73 100644 --- a/WordPress/src/main/res/drawable/img_giphy_100dp.xml +++ b/WordPress/src/main/res/drawable/img_giphy_100dp.xml @@ -8,72 +8,72 @@ android:viewportWidth="641"> diff --git a/WordPress/src/main/res/drawable/img_illustration_add_media_150dp.xml b/WordPress/src/main/res/drawable/img_illustration_add_media_150dp.xml index 624248fcd4f6..c0673b59d85f 100644 --- a/WordPress/src/main/res/drawable/img_illustration_add_media_150dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_add_media_150dp.xml @@ -8,32 +8,32 @@ android:viewportWidth="349.1"> @@ -43,7 +43,7 @@ @@ -53,7 +53,7 @@ @@ -63,17 +63,17 @@ @@ -83,17 +83,17 @@ @@ -103,67 +103,67 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_checkmark_280dp.xml b/WordPress/src/main/res/drawable/img_illustration_checkmark_280dp.xml index ace0112a8504..8e0468e5e013 100644 --- a/WordPress/src/main/res/drawable/img_illustration_checkmark_280dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_checkmark_280dp.xml @@ -15,12 +15,12 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_cloud_off_152dp.xml b/WordPress/src/main/res/drawable/img_illustration_cloud_off_152dp.xml index 59536e057f94..ed681ac99a1e 100644 --- a/WordPress/src/main/res/drawable/img_illustration_cloud_off_152dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_cloud_off_152dp.xml @@ -8,17 +8,17 @@ android:viewportWidth="152"> diff --git a/WordPress/src/main/res/drawable/img_illustration_email_alert_120dp.xml b/WordPress/src/main/res/drawable/img_illustration_email_alert_120dp.xml index 47ad07ad5902..240923e34c09 100644 --- a/WordPress/src/main/res/drawable/img_illustration_email_alert_120dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_email_alert_120dp.xml @@ -23,7 +23,7 @@ @@ -33,7 +33,7 @@ @@ -43,7 +43,7 @@ @@ -53,12 +53,12 @@ @@ -68,7 +68,7 @@ @@ -103,12 +103,12 @@ @@ -118,17 +118,17 @@ @@ -153,17 +153,17 @@ @@ -183,7 +183,7 @@ @@ -198,12 +198,12 @@ @@ -213,47 +213,47 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_empty_results_216dp.xml b/WordPress/src/main/res/drawable/img_illustration_empty_results_216dp.xml index f8ac16c2a616..65eb7879ffaa 100644 --- a/WordPress/src/main/res/drawable/img_illustration_empty_results_216dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_empty_results_216dp.xml @@ -10,267 +10,267 @@ tools:ignore="VectorRaster"> @@ -280,77 +280,77 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_hand_checkmark_button_124dp.xml b/WordPress/src/main/res/drawable/img_illustration_hand_checkmark_button_124dp.xml index 616983f92b94..a381c3baecda 100644 --- a/WordPress/src/main/res/drawable/img_illustration_hand_checkmark_button_124dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_hand_checkmark_button_124dp.xml @@ -8,27 +8,27 @@ android:viewportWidth="124"> @@ -38,22 +38,22 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_info_outline_88dp.xml b/WordPress/src/main/res/drawable/img_illustration_info_outline_88dp.xml index 40de0fe81744..95f0c7224bb4 100644 --- a/WordPress/src/main/res/drawable/img_illustration_info_outline_88dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_info_outline_88dp.xml @@ -8,12 +8,12 @@ android:viewportWidth="88.0"> diff --git a/WordPress/src/main/res/drawable/img_illustration_insights_94dp.xml b/WordPress/src/main/res/drawable/img_illustration_insights_94dp.xml index 181a04b83039..994cc79c5986 100644 --- a/WordPress/src/main/res/drawable/img_illustration_insights_94dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_insights_94dp.xml @@ -8,122 +8,122 @@ android:viewportWidth="88"> diff --git a/WordPress/src/main/res/drawable/img_illustration_media_105dp.xml b/WordPress/src/main/res/drawable/img_illustration_media_105dp.xml index 9c0e265050b2..57c705691583 100644 --- a/WordPress/src/main/res/drawable/img_illustration_media_105dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_media_105dp.xml @@ -8,57 +8,57 @@ android:viewportWidth="105"> diff --git a/WordPress/src/main/res/drawable/img_illustration_notifications_152dp.xml b/WordPress/src/main/res/drawable/img_illustration_notifications_152dp.xml index 3d5f4ec21523..911e343c4513 100644 --- a/WordPress/src/main/res/drawable/img_illustration_notifications_152dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_notifications_152dp.xml @@ -8,32 +8,32 @@ android:viewportWidth="226.0"> @@ -43,82 +43,82 @@ @@ -128,82 +128,82 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_pages_104dp.xml b/WordPress/src/main/res/drawable/img_illustration_pages_104dp.xml index dda79fa51325..31df305ff9db 100644 --- a/WordPress/src/main/res/drawable/img_illustration_pages_104dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_pages_104dp.xml @@ -8,67 +8,67 @@ android:viewportWidth="104"> diff --git a/WordPress/src/main/res/drawable/img_illustration_posts_75dp.xml b/WordPress/src/main/res/drawable/img_illustration_posts_75dp.xml index 35037949bb29..f1251bdcd003 100644 --- a/WordPress/src/main/res/drawable/img_illustration_posts_75dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_posts_75dp.xml @@ -8,62 +8,62 @@ android:viewportWidth="75"> diff --git a/WordPress/src/main/res/drawable/img_illustration_site_about_182dp.xml b/WordPress/src/main/res/drawable/img_illustration_site_about_182dp.xml index cd9ea58e1c07..a6a605bae56b 100644 --- a/WordPress/src/main/res/drawable/img_illustration_site_about_182dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_site_about_182dp.xml @@ -8,127 +8,127 @@ android:viewportWidth="182.0"> @@ -138,12 +138,12 @@ @@ -153,7 +153,7 @@ @@ -163,27 +163,27 @@ @@ -193,12 +193,12 @@ @@ -208,52 +208,52 @@ @@ -263,12 +263,12 @@ @@ -283,37 +283,37 @@ @@ -323,132 +323,132 @@ @@ -458,157 +458,157 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_site_about_280dp.xml b/WordPress/src/main/res/drawable/img_illustration_site_about_280dp.xml index d6941a97c101..90dab6047ad5 100644 --- a/WordPress/src/main/res/drawable/img_illustration_site_about_280dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_site_about_280dp.xml @@ -10,127 +10,127 @@ tools:ignore="VectorRaster"> @@ -140,12 +140,12 @@ @@ -155,7 +155,7 @@ @@ -165,27 +165,27 @@ @@ -195,12 +195,12 @@ @@ -210,52 +210,52 @@ @@ -265,12 +265,12 @@ @@ -285,37 +285,37 @@ @@ -325,132 +325,132 @@ @@ -460,157 +460,157 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_site_brush_191dp.xml b/WordPress/src/main/res/drawable/img_illustration_site_brush_191dp.xml index 821b8f91293c..2e411dfa0d76 100644 --- a/WordPress/src/main/res/drawable/img_illustration_site_brush_191dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_site_brush_191dp.xml @@ -8,7 +8,7 @@ android:viewportWidth="191.0"> @@ -18,47 +18,47 @@ @@ -68,12 +68,12 @@ @@ -83,7 +83,7 @@ @@ -103,42 +103,42 @@ @@ -148,22 +148,22 @@ @@ -173,12 +173,12 @@ @@ -193,32 +193,32 @@ @@ -228,32 +228,32 @@ @@ -263,12 +263,12 @@ @@ -278,57 +278,57 @@ diff --git a/WordPress/src/main/res/drawable/img_illustration_site_wordpress_camera_pencils_226dp.xml b/WordPress/src/main/res/drawable/img_illustration_site_wordpress_camera_pencils_226dp.xml index 5744a6065f2e..199246c9bc50 100644 --- a/WordPress/src/main/res/drawable/img_illustration_site_wordpress_camera_pencils_226dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_site_wordpress_camera_pencils_226dp.xml @@ -10,112 +10,112 @@ tools:ignore="VectorRaster"> diff --git a/WordPress/src/main/res/drawable/img_illustration_stats_226dp.xml b/WordPress/src/main/res/drawable/img_illustration_stats_226dp.xml index 0a2ddaac34ba..3e41655cd8bf 100644 --- a/WordPress/src/main/res/drawable/img_illustration_stats_226dp.xml +++ b/WordPress/src/main/res/drawable/img_illustration_stats_226dp.xml @@ -10,12 +10,12 @@ tools:ignore="VectorRaster"> @@ -30,167 +30,167 @@ diff --git a/WordPress/src/main/res/drawable/img_promo_editor.xml b/WordPress/src/main/res/drawable/img_promo_editor.xml index 9afac004faf1..8d4f582c6f18 100644 --- a/WordPress/src/main/res/drawable/img_promo_editor.xml +++ b/WordPress/src/main/res/drawable/img_promo_editor.xml @@ -15,37 +15,37 @@ @@ -55,27 +55,27 @@ diff --git a/WordPress/src/main/res/drawable/img_promo_stats_widget.xml b/WordPress/src/main/res/drawable/img_promo_stats_widget.xml index 84ac91e02831..83275b76541d 100644 --- a/WordPress/src/main/res/drawable/img_promo_stats_widget.xml +++ b/WordPress/src/main/res/drawable/img_promo_stats_widget.xml @@ -10,7 +10,7 @@ tools:ignore="VectorRaster"> @@ -45,37 +45,37 @@ @@ -85,12 +85,12 @@ @@ -105,7 +105,7 @@ diff --git a/WordPress/src/main/res/drawable/invites_border.xml b/WordPress/src/main/res/drawable/invites_border.xml index 66dc215638b9..6773a46a7af4 100644 --- a/WordPress/src/main/res/drawable/invites_border.xml +++ b/WordPress/src/main/res/drawable/invites_border.xml @@ -1,6 +1,6 @@ - + diff --git a/WordPress/src/main/res/drawable/media_item_background.xml b/WordPress/src/main/res/drawable/media_item_background.xml index dc34119c1e95..dd6b3767eb33 100644 --- a/WordPress/src/main/res/drawable/media_item_background.xml +++ b/WordPress/src/main/res/drawable/media_item_background.xml @@ -1,8 +1,8 @@ - + + android:color="@color/neutral_20" /> diff --git a/WordPress/src/main/res/drawable/moderate_button_selector.xml b/WordPress/src/main/res/drawable/moderate_button_selector.xml index 9caefbccef30..13edd106cc9f 100644 --- a/WordPress/src/main/res/drawable/moderate_button_selector.xml +++ b/WordPress/src/main/res/drawable/moderate_button_selector.xml @@ -17,7 +17,7 @@ - + diff --git a/WordPress/src/main/res/drawable/nav_bar_button_background.xml b/WordPress/src/main/res/drawable/nav_bar_button_background.xml index faa9091fdd9d..23570394c05b 100644 --- a/WordPress/src/main/res/drawable/nav_bar_button_background.xml +++ b/WordPress/src/main/res/drawable/nav_bar_button_background.xml @@ -3,5 +3,5 @@ android:shape="rectangle"> - + diff --git a/WordPress/src/main/res/drawable/nav_bar_button_selector.xml b/WordPress/src/main/res/drawable/nav_bar_button_selector.xml index daeda889d156..2bf895430e90 100644 --- a/WordPress/src/main/res/drawable/nav_bar_button_selector.xml +++ b/WordPress/src/main/res/drawable/nav_bar_button_selector.xml @@ -2,7 +2,7 @@ - - + + diff --git a/WordPress/src/main/res/drawable/nux_primary_button_selector.xml b/WordPress/src/main/res/drawable/nux_primary_button_selector.xml index de11f20e0e67..e0956f55ab41 100644 --- a/WordPress/src/main/res/drawable/nux_primary_button_selector.xml +++ b/WordPress/src/main/res/drawable/nux_primary_button_selector.xml @@ -1,9 +1,9 @@ + android:color="@color/primary_70"> - + diff --git a/WordPress/src/main/res/drawable/photo_picker_circle_pressed.xml b/WordPress/src/main/res/drawable/photo_picker_circle_pressed.xml index 31e6cb803551..11ee10af61e2 100644 --- a/WordPress/src/main/res/drawable/photo_picker_circle_pressed.xml +++ b/WordPress/src/main/res/drawable/photo_picker_circle_pressed.xml @@ -1,6 +1,6 @@ - + diff --git a/WordPress/src/main/res/drawable/plugin_placeholder.xml b/WordPress/src/main/res/drawable/plugin_placeholder.xml index e27cd99cbc61..2a530761eb19 100644 --- a/WordPress/src/main/res/drawable/plugin_placeholder.xml +++ b/WordPress/src/main/res/drawable/plugin_placeholder.xml @@ -1,7 +1,7 @@ - + + android:color="@color/primary_70" /> diff --git a/WordPress/src/main/res/drawable/reader_gap_marker_background.xml b/WordPress/src/main/res/drawable/reader_gap_marker_background.xml index 53fa528662cd..605c890b7c91 100644 --- a/WordPress/src/main/res/drawable/reader_gap_marker_background.xml +++ b/WordPress/src/main/res/drawable/reader_gap_marker_background.xml @@ -2,13 +2,13 @@ - + - + diff --git a/WordPress/src/main/res/drawable/ripple_oval.xml b/WordPress/src/main/res/drawable/ripple_oval.xml index c5855be440e9..b0578ca94d77 100644 --- a/WordPress/src/main/res/drawable/ripple_oval.xml +++ b/WordPress/src/main/res/drawable/ripple_oval.xml @@ -3,7 +3,7 @@ android:color="?android:colorControlHighlight"> - + diff --git a/WordPress/src/main/res/drawable/stats_bar_background.xml b/WordPress/src/main/res/drawable/stats_bar_background.xml index 5f54ef2f49dc..9d9ba1cc153b 100644 --- a/WordPress/src/main/res/drawable/stats_bar_background.xml +++ b/WordPress/src/main/res/drawable/stats_bar_background.xml @@ -15,7 +15,7 @@ - + diff --git a/WordPress/src/main/res/drawable/stats_widget_header_background.xml b/WordPress/src/main/res/drawable/stats_widget_header_background.xml index 0a8bf2d8a242..3e070b9487c0 100644 --- a/WordPress/src/main/res/drawable/stats_widget_header_background.xml +++ b/WordPress/src/main/res/drawable/stats_widget_header_background.xml @@ -3,7 +3,7 @@ - + diff --git a/WordPress/src/main/res/drawable/tab_divider_wordpress.xml b/WordPress/src/main/res/drawable/tab_divider_wordpress.xml index a92f4acc0588..1c016ad3886c 100644 --- a/WordPress/src/main/res/drawable/tab_divider_wordpress.xml +++ b/WordPress/src/main/res/drawable/tab_divider_wordpress.xml @@ -1,6 +1,6 @@ - + diff --git a/WordPress/src/main/res/drawable/tag_list_circle.xml b/WordPress/src/main/res/drawable/tag_list_circle.xml index 625c114022b4..fe1b56f4234b 100644 --- a/WordPress/src/main/res/drawable/tag_list_circle.xml +++ b/WordPress/src/main/res/drawable/tag_list_circle.xml @@ -4,5 +4,5 @@ + android:color="@color/primary_40"/> diff --git a/WordPress/src/main/res/layout-land/login_intro_template_view.xml b/WordPress/src/main/res/layout-land/login_intro_template_view.xml index 6096c95ef9c9..200959eb42e6 100644 --- a/WordPress/src/main/res/layout-land/login_intro_template_view.xml +++ b/WordPress/src/main/res/layout-land/login_intro_template_view.xml @@ -2,7 +2,7 @@ diff --git a/WordPress/src/main/res/layout-land/site_creation_preview_screen.xml b/WordPress/src/main/res/layout-land/site_creation_preview_screen.xml index 6b2e018ddcd9..5ba6926a85eb 100644 --- a/WordPress/src/main/res/layout-land/site_creation_preview_screen.xml +++ b/WordPress/src/main/res/layout-land/site_creation_preview_screen.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/neutral_50" + android:background="@color/neutral_5" android:orientation="vertical"> diff --git a/WordPress/src/main/res/layout-sw600dp/theme_grid_cardview_header.xml b/WordPress/src/main/res/layout-sw600dp/theme_grid_cardview_header.xml index 745886f46cc7..132341537a22 100644 --- a/WordPress/src/main/res/layout-sw600dp/theme_grid_cardview_header.xml +++ b/WordPress/src/main/res/layout-sw600dp/theme_grid_cardview_header.xml @@ -29,7 +29,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" - android:textColor="@color/neutral_300" + android:textColor="@color/neutral_30" android:textSize="@dimen/text_sz_small" android:textAllCaps="true" android:text="@string/current_theme" /> @@ -69,13 +69,13 @@ android:adjustViewBounds="true" android:contentDescription="@string/customize" android:src="@drawable/ic_customize_white_24dp" - android:tint="@color/neutral_700" /> + android:tint="@color/neutral_70" /> @@ -99,13 +99,13 @@ android:adjustViewBounds="true" android:contentDescription="@string/details" android:src="@drawable/ic_info_outline_white_24dp" - android:tint="@color/neutral_700" /> + android:tint="@color/neutral_70" /> @@ -129,13 +129,13 @@ android:adjustViewBounds="true" android:contentDescription="@string/support" android:src="@drawable/ic_help_outline_white_24dp" - android:tint="@color/neutral_700" /> + android:tint="@color/neutral_70" /> diff --git a/WordPress/src/main/res/layout-sw720dp/stats_insights_all_time_item.xml b/WordPress/src/main/res/layout-sw720dp/stats_insights_all_time_item.xml index e1edf30805a8..880eeaa0750b 100644 --- a/WordPress/src/main/res/layout-sw720dp/stats_insights_all_time_item.xml +++ b/WordPress/src/main/res/layout-sw720dp/stats_insights_all_time_item.xml @@ -29,7 +29,7 @@ android:layout_marginEnd="3dp" android:contentDescription="@null" android:src="@drawable/ic_posts_white_24dp" - android:tint="@color/neutral_700" /> + android:tint="@color/neutral_70" /> + android:tint="@color/neutral_70" /> + android:tint="@color/neutral_70" /> + android:tint="@color/warning_50" /> @@ -68,7 +68,7 @@ android:ellipsize="end" android:lines="1" android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" tools:text="Administrator"/> @@ -85,7 +85,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" tools:ignore="RelativeOverlap" tools:text="January 8, 2018"/> @@ -94,7 +94,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" tools:ignore="RelativeOverlap" tools:text="11:32 PM"/> @@ -106,7 +106,7 @@ android:layout_height="wrap_content" android:layout_marginTop="24dp" android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:linksClickable="true" tools:text="Jetpack by WordPress.com autoupdated to 5.6" android:focusable="true"/> @@ -117,7 +117,7 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" tools:text="Plugin autoupdated"/> + android:tint="@color/primary_40"/> + android:textColor="@color/primary_40"/> diff --git a/WordPress/src/main/res/layout/activity_log_list_event_item.xml b/WordPress/src/main/res/layout/activity_log_list_event_item.xml index a7ded1d9637d..d30ccd5a5df7 100644 --- a/WordPress/src/main/res/layout/activity_log_list_event_item.xml +++ b/WordPress/src/main/res/layout/activity_log_list_event_item.xml @@ -26,7 +26,7 @@ android:layout_margin="@dimen/activity_log_icon_margin" android:layout_width="@dimen/activity_log_icon_size" android:padding="@dimen/margin_medium" - tools:background="@drawable/bg_oval_neutral_300" + tools:background="@drawable/bg_oval_neutral_30" tools:src="@drawable/ic_comment_white_24dp" > @@ -41,7 +41,7 @@ android:layout_width="wrap_content" android:padding="@dimen/activity_log_icon_margin" android:src="@drawable/ic_history_white_24dp" - android:tint="@color/primary_500" > + android:tint="@color/primary_50" > @@ -74,7 +74,7 @@ android:layout_width="wrap_content" android:singleLine="true" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" tools:text="Comment posted" > diff --git a/WordPress/src/main/res/layout/activity_log_list_footer_item.xml b/WordPress/src/main/res/layout/activity_log_list_footer_item.xml index e5de8d088560..5b177f39e84b 100644 --- a/WordPress/src/main/res/layout/activity_log_list_footer_item.xml +++ b/WordPress/src/main/res/layout/activity_log_list_footer_item.xml @@ -10,5 +10,5 @@ android:padding="@dimen/margin_extra_large" android:text="@string/activity_log_limited_content_on_free_plan" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_500" > + android:textColor="@color/neutral_50" > diff --git a/WordPress/src/main/res/layout/activity_log_list_header_item.xml b/WordPress/src/main/res/layout/activity_log_list_header_item.xml index ff76cf38161d..de56da6d4605 100644 --- a/WordPress/src/main/res/layout/activity_log_list_header_item.xml +++ b/WordPress/src/main/res/layout/activity_log_list_header_item.xml @@ -13,6 +13,6 @@ android:paddingStart="@dimen/margin_extra_large" android:paddingTop="@dimen/margin_large" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body2" - android:textColor="@color/neutral_500" + android:textColor="@color/neutral_50" tools:text="Now" > diff --git a/WordPress/src/main/res/layout/activity_log_list_progress_item.xml b/WordPress/src/main/res/layout/activity_log_list_progress_item.xml index 45ef6f505c5d..3c5825063ff4 100644 --- a/WordPress/src/main/res/layout/activity_log_list_progress_item.xml +++ b/WordPress/src/main/res/layout/activity_log_list_progress_item.xml @@ -19,7 +19,7 @@ @@ -59,7 +59,7 @@ android:layout_width="wrap_content" android:singleLine="true" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" tools:text="Rewind in progress" > @@ -79,7 +79,7 @@ @@ -43,7 +43,7 @@ android:layout_below="@id/category_name" android:layout_marginTop="20dp" android:text="@string/category_parent" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textStyle="bold" android:labelFor="@+id/parent_category" android:textSize="@dimen/text_sz_large" @@ -57,7 +57,7 @@ android:layout_height="wrap_content" android:layout_below="@id/parentDescLabel" android:layout_marginBottom="@dimen/margin_large" - android:textColor="@color/neutral_500" + android:textColor="@color/neutral_50" android:textSize="@dimen/text_sz_large" tools:listitem="@layout/wp_simple_list_item_1" android:paddingStart="0dp" diff --git a/WordPress/src/main/res/layout/categories_row.xml b/WordPress/src/main/res/layout/categories_row.xml index a6ed1d7359bb..8eb1df0c8fda 100644 --- a/WordPress/src/main/res/layout/categories_row.xml +++ b/WordPress/src/main/res/layout/categories_row.xml @@ -16,7 +16,7 @@ android:checkMarkTint="@color/neutral" android:gravity="center_vertical" android:orientation="vertical" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" tools:text="Pony Category" /> diff --git a/WordPress/src/main/res/layout/categories_row_parent.xml b/WordPress/src/main/res/layout/categories_row_parent.xml index 926836533afd..da66ff1b964e 100644 --- a/WordPress/src/main/res/layout/categories_row_parent.xml +++ b/WordPress/src/main/res/layout/categories_row_parent.xml @@ -15,7 +15,7 @@ android:gravity="center_vertical" android:orientation="vertical" android:textSize="@dimen/text_sz_large" - android:textColor="@color/neutral_500" + android:textColor="@color/neutral_50" android:paddingStart="4dp" android:paddingEnd="4dp"/> diff --git a/WordPress/src/main/res/layout/comment_detail_fragment.xml b/WordPress/src/main/res/layout/comment_detail_fragment.xml index b1eff1d740b1..301e1b20c0da 100644 --- a/WordPress/src/main/res/layout/comment_detail_fragment.xml +++ b/WordPress/src/main/res/layout/comment_detail_fragment.xml @@ -65,7 +65,7 @@ android:maxLines="1" android:paddingBottom="@dimen/margin_extra_small" android:paddingTop="@dimen/margin_extra_small" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" android:textSize="@dimen/text_sz_large" tools:text="text_post_title" android:textAlignment="viewStart" @@ -113,7 +113,7 @@ android:layout_height="wrap_content" android:paddingTop="@dimen/margin_large" android:paddingBottom="@dimen/margin_large" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textColorLink="@color/link_reader" android:background="@android:color/white" android:textIsSelectable="false" diff --git a/WordPress/src/main/res/layout/comment_dialog_fragment.xml b/WordPress/src/main/res/layout/comment_dialog_fragment.xml index c1502ffaf00b..3a64883206e3 100644 --- a/WordPress/src/main/res/layout/comment_dialog_fragment.xml +++ b/WordPress/src/main/res/layout/comment_dialog_fragment.xml @@ -20,7 +20,7 @@ android:layout_height="wrap_content" android:layout_width="match_parent" android:textAlignment="viewStart" - android:textColorHint="@color/neutral_400" + android:textColorHint="@color/neutral_40" android:textSize="@dimen/text_sz_large" > diff --git a/WordPress/src/main/res/layout/comment_listitem.xml b/WordPress/src/main/res/layout/comment_listitem.xml index da9ac071bb40..d7aa551917f7 100644 --- a/WordPress/src/main/res/layout/comment_listitem.xml +++ b/WordPress/src/main/res/layout/comment_listitem.xml @@ -33,7 +33,7 @@ android:id="@+id/image_checkmark" android:layout_width="@dimen/notifications_avatar_sz" android:layout_height="@dimen/notifications_avatar_sz" - android:background="@drawable/bg_oval_primary_400" + android:background="@drawable/bg_oval_primary_40" android:padding="@dimen/margin_medium" android:src="@drawable/ic_checkmark_white_24dp" android:contentDescription="@string/comment_checkmark_desc" @@ -78,7 +78,7 @@ android:ellipsize="end" android:lines="2" android:maxLines="2" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" tools:text="title" android:textAlignment="viewStart" diff --git a/WordPress/src/main/res/layout/detail_list_preference.xml b/WordPress/src/main/res/layout/detail_list_preference.xml index 17ecd87e5cf0..1d3a6046837b 100644 --- a/WordPress/src/main/res/layout/detail_list_preference.xml +++ b/WordPress/src/main/res/layout/detail_list_preference.xml @@ -16,7 +16,7 @@ android:focusable="true" > diff --git a/WordPress/src/main/res/layout/dialog_snackbar.xml b/WordPress/src/main/res/layout/dialog_snackbar.xml index d6151f759546..91f6a103c164 100644 --- a/WordPress/src/main/res/layout/dialog_snackbar.xml +++ b/WordPress/src/main/res/layout/dialog_snackbar.xml @@ -36,7 +36,7 @@ android:layout_below="@+id/title" android:layout_height="wrap_content" android:layout_width="match_parent" - android:textColor="@color/neutral_50" + android:textColor="@color/neutral_5" android:textSize="@dimen/text_sz_medium" android:visibility="gone" tools:text="Connect your favorite social media services to automatically share new posts with friend" @@ -61,7 +61,7 @@ android:layout_width="wrap_content" android:minHeight="@dimen/default_dialog_button_height" android:minWidth="@dimen/min_touch_target_sz" - android:textColor="@color/accent_300" + android:textColor="@color/accent_30" android:visibility="gone" tools:text="Yes, let's do it" tools:visibility="visible" @@ -77,7 +77,7 @@ android:layout_width="wrap_content" android:minHeight="@dimen/default_dialog_button_height" android:minWidth="@dimen/min_touch_target_sz" - android:textColor="@color/accent_300" + android:textColor="@color/accent_30" android:visibility="gone" tools:text="Not now" tools:visibility="visible" @@ -92,7 +92,7 @@ android:layout_width="wrap_content" android:minHeight="@dimen/default_dialog_button_height" android:minWidth="@dimen/min_touch_target_sz" - android:textColor="@color/accent_300" + android:textColor="@color/accent_30" android:visibility="gone" tools:text="Never ever" tools:visibility="visible" diff --git a/WordPress/src/main/res/layout/domain_registration_details_fragment.xml b/WordPress/src/main/res/layout/domain_registration_details_fragment.xml index b9f678d1e94f..93c401f933f6 100644 --- a/WordPress/src/main/res/layout/domain_registration_details_fragment.xml +++ b/WordPress/src/main/res/layout/domain_registration_details_fragment.xml @@ -57,7 +57,7 @@ android:paddingBottom="@dimen/margin_medium" android:paddingTop="@dimen/margin_medium" android:text="@string/domain_privacy_option_on_title" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" tools:checked="true"> @@ -69,7 +69,7 @@ android:paddingBottom="@dimen/margin_extra_large" android:paddingTop="@dimen/margin_medium" android:text="@string/domain_privacy_option_off_title" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large"> diff --git a/WordPress/src/main/res/layout/domain_suggestion_list_item.xml b/WordPress/src/main/res/layout/domain_suggestion_list_item.xml index 38f9b0e82c28..f69e834dd10d 100644 --- a/WordPress/src/main/res/layout/domain_suggestion_list_item.xml +++ b/WordPress/src/main/res/layout/domain_suggestion_list_item.xml @@ -10,7 +10,7 @@ diff --git a/WordPress/src/main/res/layout/domain_suggestions_fragment.xml b/WordPress/src/main/res/layout/domain_suggestions_fragment.xml index 13bd1e6b14de..30adcfb13828 100644 --- a/WordPress/src/main/res/layout/domain_suggestions_fragment.xml +++ b/WordPress/src/main/res/layout/domain_suggestions_fragment.xml @@ -47,7 +47,7 @@ android:layout_marginStart="@dimen/margin_extra_extra_small" android:contentDescription="@null" android:src="@drawable/ic_search_white_24dp" - android:tint="@color/neutral_300"/> + android:tint="@color/neutral_30"/> diff --git a/WordPress/src/main/res/layout/filter_spinner_item.xml b/WordPress/src/main/res/layout/filter_spinner_item.xml index 2ab8bd9f64e3..9af46e688458 100644 --- a/WordPress/src/main/res/layout/filter_spinner_item.xml +++ b/WordPress/src/main/res/layout/filter_spinner_item.xml @@ -6,8 +6,8 @@ style="@style/FilteredRecyclerViewFilterTextView.WordPress" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:drawableEnd="@drawable/ic_dropdown_blue_light_24dp" - android:drawableRight="@drawable/ic_dropdown_blue_light_24dp" + android:drawableEnd="@drawable/ic_dropdown_primary_30_24dp" + android:drawableRight="@drawable/ic_dropdown_primary_30_24dp" android:textAlignment="viewStart" android:gravity="start" android:textColor="@android:color/white" diff --git a/WordPress/src/main/res/layout/followed_sites_dialog.xml b/WordPress/src/main/res/layout/followed_sites_dialog.xml index 3b46168aeb08..579dab2e0cba 100644 --- a/WordPress/src/main/res/layout/followed_sites_dialog.xml +++ b/WordPress/src/main/res/layout/followed_sites_dialog.xml @@ -30,7 +30,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_notification_posts_switch" android:textAlignment="viewStart" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" android:theme="@style/SwitchBlueMedium" tools:checked="true" @@ -44,7 +44,7 @@ android:paddingBottom="@dimen/margin_large" android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_notification_posts_description" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" android:textSize="@dimen/text_sz_medium" > @@ -66,7 +66,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_email_posts_switch" android:textAlignment="viewStart" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" android:theme="@style/SwitchBlueMedium" tools:checked="true" @@ -92,7 +92,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_email_posts_instantly" android:textAlignment="viewEnd" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" tools:checked="true" style="@style/TextAppearance.AppCompat.Body2" > @@ -108,7 +108,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_email_posts_daily" android:textAlignment="viewEnd" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" style="@style/TextAppearance.AppCompat.Body2" > @@ -123,7 +123,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_email_posts_weekly" android:textAlignment="viewEnd" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" style="@style/TextAppearance.AppCompat.Body2" > @@ -148,7 +148,7 @@ android:paddingTop="@dimen/margin_large" android:text="@string/notification_settings_followed_dialog_email_comments" android:textAlignment="viewStart" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large" android:theme="@style/SwitchBlueMedium" style="@style/TextAppearance.AppCompat.Body2" > diff --git a/WordPress/src/main/res/layout/help_activity.xml b/WordPress/src/main/res/layout/help_activity.xml index d9c02dd4a8be..c9243af05415 100644 --- a/WordPress/src/main/res/layout/help_activity.xml +++ b/WordPress/src/main/res/layout/help_activity.xml @@ -33,7 +33,7 @@ + android:textColor="@color/neutral_40"/> @@ -49,7 +49,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/support_contact_email" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_large"/> diff --git a/WordPress/src/main/res/layout/history_detail_container_fragment.xml b/WordPress/src/main/res/layout/history_detail_container_fragment.xml index 0ed7c78b525d..e90128c9402d 100644 --- a/WordPress/src/main/res/layout/history_detail_container_fragment.xml +++ b/WordPress/src/main/res/layout/history_detail_container_fragment.xml @@ -27,7 +27,7 @@ android:minWidth="@dimen/min_touch_target_sz" android:padding="@dimen/margin_extra_large" android:src="@drawable/ic_chevron_left_white_24dp" - android:tint="@color/neutral_700_neutral_200_selector" > + android:tint="@color/neutral_70_neutral_20_selector" > @@ -63,9 +63,9 @@ android:layout_marginEnd="@dimen/margin_small_medium" android:layout_marginStart="@dimen/margin_small_medium" android:drawablePadding="@dimen/margin_small" - android:drawableStart="@drawable/bg_oval_error_500_minus_white_16dp" + android:drawableStart="@drawable/bg_oval_error_50_minus_white_16dp" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" android:visibility="gone" tools:text="1" tools:visibility="visible"> @@ -86,7 +86,7 @@ android:minWidth="@dimen/min_touch_target_sz" android:padding="@dimen/margin_extra_large" android:src="@drawable/ic_chevron_right_white_24dp" - android:tint="@color/neutral_700_neutral_200_selector" > + android:tint="@color/neutral_70_neutral_20_selector" > @@ -122,7 +122,7 @@ android:freezesText="true" android:lineSpacingExtra="@dimen/spacing_extra_title" android:padding="@dimen/margin_extra_large" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/aztec_title_size" android:textStyle="bold"/> diff --git a/WordPress/src/main/res/layout/history_detail_fragment.xml b/WordPress/src/main/res/layout/history_detail_fragment.xml index 5673167afa33..198aac219a12 100644 --- a/WordPress/src/main/res/layout/history_detail_fragment.xml +++ b/WordPress/src/main/res/layout/history_detail_fragment.xml @@ -26,7 +26,7 @@ android:layout_width="match_parent" android:lineSpacingExtra="@dimen/spacing_extra_title" android:padding="@dimen/margin_extra_large" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textIsSelectable="true" android:textSize="@dimen/aztec_title_size" android:textStyle="bold" > @@ -57,7 +57,7 @@ android:paddingStart="@dimen/margin_extra_large" android:paddingTop="@dimen/margin_extra_large" android:scrollbars="vertical" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textIsSelectable="true" android:textSize="@dimen/text_sz_post_content" > diff --git a/WordPress/src/main/res/layout/history_list_footer.xml b/WordPress/src/main/res/layout/history_list_footer.xml index d7a7f770ca8c..418402e79eb5 100644 --- a/WordPress/src/main/res/layout/history_list_footer.xml +++ b/WordPress/src/main/res/layout/history_list_footer.xml @@ -12,6 +12,6 @@ android:minHeight="?attr/listPreferredItemHeight" android:padding="@dimen/margin_extra_large" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_500" + android:textColor="@color/neutral_50" tools:text="Post Created on September 19, 2018 at 8:51am" > diff --git a/WordPress/src/main/res/layout/history_list_header.xml b/WordPress/src/main/res/layout/history_list_header.xml index b120937eacf5..371ef3b68428 100644 --- a/WordPress/src/main/res/layout/history_list_header.xml +++ b/WordPress/src/main/res/layout/history_list_header.xml @@ -13,6 +13,6 @@ android:paddingStart="@dimen/margin_extra_large" android:paddingTop="@dimen/margin_large" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body2" - android:textColor="@color/neutral_500" + android:textColor="@color/neutral_50" tools:text="Today" > diff --git a/WordPress/src/main/res/layout/history_list_item.xml b/WordPress/src/main/res/layout/history_list_item.xml index 77e87e112bae..563dbb852514 100644 --- a/WordPress/src/main/res/layout/history_list_item.xml +++ b/WordPress/src/main/res/layout/history_list_item.xml @@ -25,7 +25,7 @@ android:layout_height="@dimen/activity_log_icon_size" android:layout_margin="@dimen/activity_log_icon_margin" android:layout_width="@dimen/activity_log_icon_size" - android:src="@drawable/bg_oval_neutral_300_user_32dp" > + android:src="@drawable/bg_oval_neutral_30_user_32dp" > @@ -87,7 +87,7 @@ android:singleLine="true" android:textAlignment="viewStart" android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" tools:text="1d ago" > @@ -98,7 +98,7 @@ android:layout_width="wrap_content" android:singleLine="true" android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" - android:textColor="@color/neutral_400" + android:textColor="@color/neutral_40" tools:text="Draft" > diff --git a/WordPress/src/main/res/layout/home_row.xml b/WordPress/src/main/res/layout/home_row.xml index 718f44fcccb8..b39ba83cae21 100644 --- a/WordPress/src/main/res/layout/home_row.xml +++ b/WordPress/src/main/res/layout/home_row.xml @@ -54,7 +54,7 @@ android:singleLine="true" android:text="@string/blogusername" android:textColor="#666666" - android:textColorLink="@color/primary_500" + android:textColorLink="@color/primary_50" android:textSize="12sp" /> diff --git a/WordPress/src/main/res/layout/insert_media_dialog.xml b/WordPress/src/main/res/layout/insert_media_dialog.xml index 79185e4cd659..7f276b152827 100644 --- a/WordPress/src/main/res/layout/insert_media_dialog.xml +++ b/WordPress/src/main/res/layout/insert_media_dialog.xml @@ -85,7 +85,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|end" - android:tint="@color/neutral_400" + android:tint="@color/neutral_40" android:contentDescription="@null" tools:src="@drawable/gallery_icon_thumbnailgrid" android:layout_marginEnd="@dimen/margin_extra_large"/> diff --git a/WordPress/src/main/res/layout/invite_username_button.xml b/WordPress/src/main/res/layout/invite_username_button.xml index 81ae9aeda294..4e69335b85f3 100644 --- a/WordPress/src/main/res/layout/invite_username_button.xml +++ b/WordPress/src/main/res/layout/invite_username_button.xml @@ -14,7 +14,7 @@ android:layout_weight="1" android:layout_gravity="center_vertical" android:gravity="center_vertical" - android:textColor="@color/neutral_700" + android:textColor="@color/neutral_70" android:textSize="@dimen/text_sz_medium" android:layout_marginEnd="5dp"/> @@ -26,5 +26,5 @@ android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/remove" android:src="@drawable/ic_cross_white_24dp" - android:tint="@color/gray_600"/> + android:tint="@color/gray_60"/> diff --git a/WordPress/src/main/res/layout/jetpack_remote_install_fragment.xml b/WordPress/src/main/res/layout/jetpack_remote_install_fragment.xml index e8a71fa505b4..731cd37563bc 100644 --- a/WordPress/src/main/res/layout/jetpack_remote_install_fragment.xml +++ b/WordPress/src/main/res/layout/jetpack_remote_install_fragment.xml @@ -26,7 +26,7 @@ android:layout_marginTop="@dimen/margin_extra_large" android:contentDescription="@string/content_description_people_looking_charts" android:src="@drawable/ic_plans_white_24dp" - tools:tint="@color/jetpack"/> + tools:tint="@color/jetpack_green_50"/> + android:textColor="@color/neutral_40" />