Skip to content

Commit d5235f0

Browse files
authored
Merge pull request #37 from wordpress-mobile/merge/woocommerce-android/dark-mode
Merge WooCommerce Dark Mode changes
2 parents 91860d2 + 1d30f97 commit d5235f0

File tree

10 files changed

+28
-13
lines changed

10 files changed

+28
-13
lines changed

libs/login/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.5.1'
7+
classpath 'com.android.tools.build:gradle:3.5.3'
88
}
99
}
1010

libs/login/src/main/java/org/wordpress/android/login/LoginMagicLinkRequestFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void onClick(View v) {
156156
View avatarContainerView = view.findViewById(R.id.avatar_container);
157157

158158
LayoutParams lp = avatarContainerView.getLayoutParams();
159-
lp.width = getContext().getResources().getDimensionPixelSize(R.dimen.magic_link_sent_illustration_sz);
159+
lp.width = LayoutParams.WRAP_CONTENT;
160160
lp.height = getContext().getResources().getDimensionPixelSize(R.dimen.magic_link_sent_illustration_sz);
161161
avatarContainerView.setLayoutParams(lp);
162162

libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressHelpDialogFragment.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ public void onAttach(Context context) {
4848
@Override
4949
public Dialog onCreateDialog(Bundle savedInstanceState) {
5050
AlertDialog.Builder alert = new MaterialAlertDialogBuilder(getActivity());
51-
alert.setTitle(R.string.login_site_address_help_title);
51+
if (mLoginListener.getLoginMode() != LoginMode.WOO_LOGIN_MODE) {
52+
// Only set the title if not the woo app, since the woo app specifies an override
53+
// layout that includes the title.
54+
alert.setTitle(R.string.login_site_address_help_title);
55+
}
5256

5357
//noinspection InflateParams
5458
alert.setView(getActivity().getLayoutInflater().inflate(R.layout.login_alert_site_address_help, null));

libs/login/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ protected void setupContent(ViewGroup rootView) {
156156
siteAddressView.setText(UrlUtils.removeScheme(UrlUtils.removeXmlrpcSuffix(mInputSiteAddress)));
157157
siteAddressView.setVisibility(mInputSiteAddress != null ? View.VISIBLE : View.GONE);
158158

159-
String inputSiteAddressWithoutProtocol = UrlUtils.removeScheme(mInputSiteAddress);
160159
mInputSiteAddressWithoutSuffix = (mEndpointAddress == null || mEndpointAddress.isEmpty())
161-
? inputSiteAddressWithoutProtocol : UrlUtils.removeXmlrpcSuffix(mEndpointAddress);
160+
? mInputSiteAddress : UrlUtils.removeXmlrpcSuffix(mEndpointAddress);
162161

163162
mUsernameInput = rootView.findViewById(R.id.login_username_row);
164163
mUsernameInput.setText(mInputUsername);
@@ -194,6 +193,9 @@ public void onClick(View v) {
194193
if (mIsWpcom) {
195194
mLoginListener.forgotPassword(FORGOT_PASSWORD_URL_WPCOM);
196195
} else {
196+
if (!mInputSiteAddressWithoutSuffix.endsWith("/")) {
197+
mInputSiteAddressWithoutSuffix += "/";
198+
}
197199
mLoginListener.forgotPassword(mInputSiteAddressWithoutSuffix);
198200
}
199201
}

libs/login/src/main/java/org/wordpress/android/login/util/SiteUtils.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ public static ArrayList<Integer> getCurrentSiteIds(SiteStore siteStore, boolean
2222

2323
@Nullable
2424
public static SiteModel getXMLRPCSiteByUrl(SiteStore siteStore, String url) {
25-
List<SiteModel> selfhostedSites = siteStore.getSitesAccessedViaXMLRPC();
26-
if (selfhostedSites != null && !selfhostedSites.isEmpty()) {
27-
for (SiteModel siteModel : selfhostedSites) {
25+
return getSiteByMatchingUrl(siteStore.getSitesAccessedViaXMLRPC(), url);
26+
}
27+
28+
@Nullable
29+
public static SiteModel getSiteByMatchingUrl(SiteStore siteStore, String url) {
30+
return getSiteByMatchingUrl(siteStore.getSites(), url);
31+
}
32+
33+
@Nullable
34+
private static SiteModel getSiteByMatchingUrl(List<SiteModel> siteModelList, String url) {
35+
if (siteModelList != null && !siteModelList.isEmpty()) {
36+
for (SiteModel siteModel : siteModelList) {
2837
String storedSiteUrl = UrlUtils.removeScheme(siteModel.getUrl()).replace("/", "");
2938
String incomingSiteUrl = UrlUtils.removeScheme(url).replace("/", "");
3039
if (storedSiteUrl.equalsIgnoreCase(incomingSiteUrl)) {

libs/login/src/main/res/layout-land/login_magic_link_sent_screen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ImageView
1818
android:id="@+id/image"
19-
android:layout_width="@dimen/magic_link_sent_illustration_sz"
19+
android:layout_width="wrap_content"
2020
android:layout_height="@dimen/magic_link_sent_illustration_sz"
2121
android:contentDescription="@null"
2222
android:scaleType="centerInside"

libs/login/src/main/res/layout-land/signup_magic_link.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ImageView
1818
android:id="@+id/signup_magic_link_image"
19-
android:layout_width="@dimen/magic_link_sent_illustration_sz"
19+
android:layout_width="wrap_content"
2020
android:layout_height="@dimen/magic_link_sent_illustration_sz"
2121
android:contentDescription="@null"
2222
android:scaleType="centerInside"

libs/login/src/main/res/layout/login_magic_link_sent_screen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ImageView
1111
android:id="@+id/image"
12-
android:layout_width="@dimen/magic_link_sent_illustration_sz"
12+
android:layout_width="wrap_content"
1313
android:layout_height="@dimen/magic_link_sent_illustration_sz"
1414
android:layout_marginTop="@dimen/margin_extra_extra_large"
1515
android:contentDescription="@null"

libs/login/src/main/res/layout/signup_magic_link.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ImageView
1515
android:id="@+id/signup_magic_link_image"
16-
android:layout_width="@dimen/magic_link_sent_illustration_sz"
16+
android:layout_width="wrap_content"
1717
android:layout_height="@dimen/magic_link_sent_illustration_sz"
1818
android:layout_centerHorizontal="true"
1919
android:contentDescription="@null"

libs/login/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<string name="open_mail">Open mail</string>
2323
<string name="alternatively">Alternatively:</string>
2424
<string name="enter_site_address_instead">Log in by entering your site address.</string>
25-
<string name="enter_site_credentials_instead">Log in with site credentials</string>
25+
<string name="enter_site_credentials_instead">Log in with site credentials.</string>
2626
<string name="enter_username_instead">Log in with your username.</string>
2727
<string name="enter_verification_code">Almost there! Please enter the verification code from your Authenticator app.</string>
2828
<string name="enter_verification_code_sms">We sent a text message to the phone number ending in %s. Please enter the verification code in the SMS.</string>

0 commit comments

Comments
 (0)