Skip to content

Commit

Permalink
Merge branch 'develop' into issue/11599-me-gravatar-menu-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
develric committed Apr 14, 2020
2 parents 5ab3139 + 2463a61 commit 2022664
Show file tree
Hide file tree
Showing 34 changed files with 364 additions and 430 deletions.
4 changes: 2 additions & 2 deletions .configure
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"project_name": "WordPress-Android",
"branch": "master",
"pinned_hash": "eb32678967bdbe1e100a6dbb4cf8adeb8935e335",
"pinned_hash": "c9fee80926844dde0c23d55128de6232539571e2",
"files_to_copy": [
{
"file": "android/WPAndroid/gradle.properties",
Expand All @@ -27,4 +27,4 @@
"file_dependencies": [

]
}
}
Binary file modified .configure-files/gradle.properties.enc
Binary file not shown.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-----
* Block editor: You can now crop, zoom in/out and rotate images that are already inserted in a post.
* Fix a deeplinking issue that could lead to the app not being open after clicking on some special "wordpress://" URLs.
* Site Creation: Improved look of the loading screen while the site is being created
* Block editor: New block: Cover
* Block editor: Improve icon on the "Take a Video" media option
* Block editor: Removed the dimming effect on unselected blocks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

@Override
protected void onResume() {
super.onResume();
// keep setBackground in the onResume, otherwise the transition between activities is visible to the user when
// sharing text with an account with one visible site
findViewById(R.id.main_view).setBackgroundResource(R.color.background_default);
}

private void refreshContent() {
if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) {
List<SiteModel> visibleSites = mSiteStore.getVisibleSites();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.wordpress.android.ui.main.SitePickerAdapter.SiteList;
import org.wordpress.android.ui.media.MediaBrowserActivity;
import org.wordpress.android.ui.posts.EditPostActivity;
import org.wordpress.android.util.ContextExtensionsKt;
import org.wordpress.android.util.ViewUtils;
import org.wordpress.android.util.image.ImageManager;

import javax.inject.Inject;
Expand Down Expand Up @@ -171,20 +169,8 @@ 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_50));
ViewUtils.setButtonBackgroundColor(getContext(), mShareMediaBtn,
R.style.WordPress_Button_Grey,
R.attr.colorButtonNormal);
} else {
mBottomButtonsShadow.setVisibility(View.GONE);
mBottomButtonsContainer.setBackground(null);
mShareMediaBtn.setTextColor(
ContextExtensionsKt
.getColorFromAttribute(getContext(), R.attr.wpColorText));
ViewUtils.setButtonBackgroundColor(getContext(), mShareMediaBtn,
R.style.WordPress_Button,
R.attr.colorButtonNormal);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
import org.wordpress.android.ui.uploads.UploadUtils;
import org.wordpress.android.ui.uploads.UploadUtilsWrapper;
import org.wordpress.android.ui.uploads.VideoOptimizer;
import org.wordpress.android.ui.utils.AuthenticationUtils;
import org.wordpress.android.ui.utils.UiHelpers;
import org.wordpress.android.util.ActivityUtils;
import org.wordpress.android.util.AniUtils;
Expand Down Expand Up @@ -2671,14 +2672,15 @@ public void onVideoPressInfoRequested(final String videoId) {
}

@Override
public String onAuthHeaderRequested(String url) {
String authHeader = "";
public Map<String, String> onAuthHeaderRequested(String url) {
Map<String, String> authHeaders = new HashMap<>();

String token = mAccountStore.getAccessToken();
if (mSite.isPrivate() && WPUrlUtils.safeToAddWordPressComAuthToken(url)
&& !TextUtils.isEmpty(token)) {
authHeader = "Bearer " + token;
authHeaders.put(AuthenticationUtils.AUTHORIZATION_HEADER_NAME, "Bearer " + token);
}
return authHeader;
return authHeaders;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import javax.inject.Named

class ReactNativeRequestHandler @Inject constructor(
private val reactNativeStore: ReactNativeStore,
private val urlUtil: ReactNativeUrlUtil,
@Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher
) : CoroutineScope {
override val coroutineContext = bgDispatcher + Job()
Expand All @@ -31,11 +30,8 @@ class ReactNativeRequestHandler @Inject constructor(
onError: Consumer<Bundle>
) {
launch {
if (mSite.isUsingWpComRestApi) {
performGetRequestForWPComSite(pathWithParams, mSite.siteId, onSuccess::accept, onError::accept)
} else {
performGetRequestForSelfHostedSite(pathWithParams, mSite.url, onSuccess::accept, onError::accept)
}
val response = reactNativeStore.executeRequest(mSite, pathWithParams)
handleResponse(response, onSuccess::accept, onError::accept)
}
}

Expand All @@ -49,30 +45,6 @@ class ReactNativeRequestHandler @Inject constructor(
coroutineContext[Job]!!.cancel()
}

private suspend fun performGetRequestForWPComSite(
pathWithParams: String,
wpComSiteId: Long,
onSuccess: (String) -> Unit,
onError: (Bundle) -> Unit
) {
urlUtil.parseUrlAndParamsForWPCom(pathWithParams, wpComSiteId)?.let { (url, params) ->
val response = reactNativeStore.performWPComRequest(url, params)
handleResponse(response, onSuccess, onError)
}
}

private suspend fun performGetRequestForSelfHostedSite(
pathWithParams: String,
siteUrl: String,
onSuccess: (String) -> Unit,
onError: (Bundle) -> Unit
) {
urlUtil.parseUrlAndParamsForWPOrg(pathWithParams, siteUrl)?.let { (url, params) ->
val response = reactNativeStore.performWPAPIRequest(url, params)
handleResponse(response, onSuccess, onError)
}
}

private fun handleResponse(
response: ReactNativeFetchResponse,
onSuccess: (String) -> Unit,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.wordpress.android.ui.sitecreation.previews

import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
Expand Down Expand Up @@ -37,6 +39,8 @@ import org.wordpress.android.ui.sitecreation.previews.SitePreviewViewModel.SiteP
import org.wordpress.android.ui.sitecreation.previews.SitePreviewViewModel.SitePreviewUiState.SitePreviewWebErrorUiState
import org.wordpress.android.ui.sitecreation.services.SiteCreationService
import org.wordpress.android.ui.utils.UiHelpers
import org.wordpress.android.util.AniUtils
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AutoForeground.ServiceEventConnection
import org.wordpress.android.util.ErrorManagedWebViewClient.ErrorManagedWebViewClientListener
import org.wordpress.android.util.URLFilteredWebViewClient
Expand All @@ -63,6 +67,8 @@ class SiteCreationPreviewFragment : SiteCreationBaseFormFragment(),
private lateinit var sitePreviewWebError: ViewGroup
private lateinit var sitePreviewWebViewShimmerLayout: ShimmerFrameLayout
private lateinit var sitePreviewWebUrlTitle: TextView
private lateinit var loadingTextLayout: ViewGroup
private lateinit var loadingTextView: TextView

@Inject internal lateinit var viewModelFactory: ViewModelProvider.Factory
@Inject internal lateinit var uiHelpers: UiHelpers
Expand Down Expand Up @@ -108,6 +114,8 @@ class SiteCreationPreviewFragment : SiteCreationBaseFormFragment(),
sitePreviewWebViewShimmerLayout = rootView.findViewById(R.id.sitePreviewWebViewShimmerLayout)
sitePreviewWebUrlTitle = rootView.findViewById(R.id.sitePreviewWebUrlTitle)
okButtonContainer = rootView.findViewById(R.id.sitePreviewOkButtonContainer)
loadingTextView = fullscreenProgressLayout.findViewById(R.id.progress_text)
loadingTextLayout = fullscreenProgressLayout.findViewById(R.id.progress_text_layout)
initViewModel()
initRetryButton()
initOkButton()
Expand Down Expand Up @@ -214,7 +222,33 @@ class SiteCreationPreviewFragment : SiteCreationBaseFormFragment(),

private fun updateLoadingLayout(progressUiState: SitePreviewFullscreenProgressUiState) {
progressUiState.apply {
uiHelpers.setTextOrHide(fullscreenProgressLayout.findViewById(R.id.progress_text), loadingTextResId)
val newText = uiHelpers.getTextOfUiString(loadingTextView.context, loadingTextResId)
AppLog.d(AppLog.T.MAIN, "Changing text - animation: $animate")
if (animate) {
updateLoadingTextWithFadeAnimation(newText)
} else {
loadingTextView.text = newText
}
}
}

private fun updateLoadingTextWithFadeAnimation(newText: String) {
val animationDuration = AniUtils.Duration.SHORT
val fadeOut = AniUtils.getFadeOutAnim(loadingTextLayout, animationDuration, View.VISIBLE)
val fadeIn = AniUtils.getFadeInAnim(loadingTextLayout, animationDuration)

// update the text when the view isn't visible
fadeIn.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
loadingTextView.text = newText
}
})
// Start the fadein animation right after the view fades out
fadeIn.startDelay = animationDuration.toMillis(loadingTextLayout.context)

AnimatorSet().apply {
playSequentially(fadeOut, fadeIn)
start()
}
}

Expand Down
Loading

0 comments on commit 2022664

Please sign in to comment.