-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code-cleanup #2
base: master
Are you sure you want to change the base?
code-cleanup #2
Conversation
@@ -52,6 +52,7 @@ class InboxViewer : Fragment() { | |||
} | |||
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |||
super.onViewCreated(view, savedInstanceState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
super.onResume() | ||
webView.onResume() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
super.onDestroy() | ||
webView.destroy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one, however, is not correct. The application's onDestroy
might rely on something that is torn down in the super class. Google's recommendation is to call super first when creating/starting things, but last when pausing/stopping things.
@@ -1,8 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
android:layout_height="match_parent"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair.
companion object { | ||
val DATE_FORMAT: DateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.ENGLISH) | ||
} | ||
private val dateFormat: DateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair.
@@ -64,7 +64,7 @@ abstract class SdkFragment : Fragment() { | |||
} | |||
} | |||
|
|||
internal fun String.showSnackbar(length: Int = Snackbar.LENGTH_SHORT) { | |||
protected fun String.showSnackbar(length: Int = Snackbar.LENGTH_SHORT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair.
ViewSwitcher Orientation Feature:
Change: Removed orientation property from ViewSwitcher.
Reason: This property was unused and caused confusion, so it was removed to simplify the code.
showSnackbar Function:
Change: Changed the access level of showSnackbar from internal to protected.
Reason: The function was only accessible to classes within the same module when it was internal. However, this function can only be used by subclasses of the SdkFragment class. Making it protected ensures that the function can only be accessed by subclasses of SdkFragment.
InboxViewer Class Lifecycle Functions:
Change: Super calls were made first in the onResume, onDestroy, and onViewCreated functions.
Reason: This change ensures that the class is protected from unexpected behavior by performing the default actions of the lifecycle functions first, and also increases overall compatibility.
Inbox Class Date Format:
Change: Proposed that the date format in the Inbox class be set according to locale.
Reason: It is suggested that the date format be determined according to the user's locale to improve the user experience. This way, users can view dates in a format that they are more familiar with.