Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

webページからリンク先のPDFファイルが開けない不具合の修正 #163

Merged
merged 1 commit into from
Jun 19, 2018

Conversation

vfa-cancc
Copy link
Contributor

概要(Summary)

動作確認手順(Step for Confirmation)

Run the unit test.
Confirm operation.

extension = url.substring(url.lastIndexOf("."));
}
if(!url.contains(GOOGLE_DOCS_BASE_VIEWER_URL)
&& Arrays.asList(arrOfficeFilenameExt).contains(extension.toLowerCase(Locale.getDefault()))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfa-cancc
Vì sao cần Locale.getDefault() ?
Có thể gọi hàm toLowerCase() mà không có tham số.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nếu không có tham số Locale sẽ bị lint warning khi build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfa-cancc
Theo tài liệu của java thì toLowerCase() tương đương toLowerCase(Locale.getDefault())
(https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#toLowerCase())
Ngoài ra, anh tìm thử open source thì thấy bên trong toLowerCase() cũng gọi toLowerCase(Locale.getDefault()).
(http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/String.java#l2654)
Nên để tránh warning này thì nên dùng suppressLint.
Bởi vì code theo cách toLowerCase(Locale.getDefault()) sẽ làm cho source code trở nên rối hơn, kì quặt và ko thống nhất giữa các hệ thống (chẳng hạn trong powerpush vẫn có rất nhiều chỗ xài toLowerCase()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Đã chuyển sang sử dụng @SuppressLint("DefaultLocale")

@vfa-duyna vfa-duyna changed the base branch from master to develop June 14, 2018 06:23
@vfa-duyna vfa-duyna changed the title fix open pdf link in webview webページからリンク先のPDFファイルが開けない不具合の修正 Jun 14, 2018
@vfa-cancc vfa-cancc force-pushed the fix/open_link_pdf_in_richpush_webview branch from 88b1296 to 1c0c01d Compare June 14, 2018 07:07
Copy link
Contributor

@morisatoru morisatoru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー指摘点ありません。

@morisatoru morisatoru merged commit 8aa50f6 into develop Jun 19, 2018
@morisatoru morisatoru mentioned this pull request Jul 18, 2018
@vfa-cancc vfa-cancc deleted the fix/open_link_pdf_in_richpush_webview branch July 27, 2018 03:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants