Skip to content
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

[Nullability Annotations to Java Classes] Add Missing Nullability Annotations to All SDK Override Methods for Activities #18997

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
346a8f8
Analysis: Add missing n-a to sdk override methods for web view
ParaskP7 Aug 10, 2023
be35881
Analysis: Add missing n-a to sdk override methods for wp web view
ParaskP7 Aug 10, 2023
1ebb789
Analysis: Add missing n-a to sdk override methods for theme web
ParaskP7 Aug 10, 2023
064b8ee
Analysis: Add missing n-a to sdk override methods for jetpack web view
ParaskP7 Aug 10, 2023
91a632a
Analysis: Add missing n-a to sdk override methods for ssl certs view
ParaskP7 Aug 10, 2023
2d6457f
Analysis: Add missing n-a to sdk override methods for add qp shortcut
ParaskP7 Aug 10, 2023
e31f056
Analysis: Add missing n-a to sdk override methods for app log viewer
ParaskP7 Aug 10, 2023
c035d76
Analysis: Suppress non constant res id lint warning for app log viewer
ParaskP7 Aug 10, 2023
adb1e7f
Analysis: Add missing n-a to sdk override methods for jetpack connection
ParaskP7 Aug 10, 2023
56febf4
Analysis: Add missing n-a to sdk override methods for share receiver
ParaskP7 Aug 10, 2023
4737bfb
Analysis: Add missing n-a to sdk override methods for login
ParaskP7 Aug 10, 2023
dfefa3b
Analysis: Add missing n-a to sdk override methods for login epilogue
ParaskP7 Aug 10, 2023
7f4cbaa
Analysis: Add missing n-a to sdk override methods for login magic link
ParaskP7 Aug 10, 2023
4e9a2c1
Analysis: Add missing n-a to sdk override methods for signup epilogue
ParaskP7 Aug 10, 2023
a0da7cd
Analysis: Add missing n-a to sdk override methods for comments detail
ParaskP7 Aug 10, 2023
3e92a6d
Analysis: Add missing n-a to sdk override methods for edit comment
ParaskP7 Aug 10, 2023
8a38d8c
Analysis: Add missing n-a to sdk override methods for deep linking
ParaskP7 Aug 11, 2023
88d274f
Analysis: Add missing n-a to sdk override methods for site picker
ParaskP7 Aug 11, 2023
2b54a8b
Analysis: Add missing n-a to sdk override methods for wp main
ParaskP7 Aug 11, 2023
7a7fc66
Analysis: Add missing n-a to sdk override methods for media browser
ParaskP7 Aug 11, 2023
3588f84
Analysis: Suppress non constant res id lint warning for media browser
ParaskP7 Aug 11, 2023
4152299
Analysis: Add missing n-a to sdk override methods for media preview
ParaskP7 Aug 11, 2023
7753264
Analysis: Add missing n-a to sdk override methods for media settings
ParaskP7 Aug 11, 2023
387099e
Analysis: Add missing n-a to sdk override methods for notifications
ParaskP7 Aug 11, 2023
4db5b4e
Analysis: Add missing n-a to sdk override methods for people management
ParaskP7 Aug 11, 2023
cd60734
Analysis: Add missing n-a to sdk override methods for photo picker
ParaskP7 Aug 11, 2023
4b0d8a3
Analysis: Add missing n-a to sdk override methods for plugin browser
ParaskP7 Aug 11, 2023
9a80cba
Analysis: Add missing n-a to sdk override methods for plugin detail
ParaskP7 Aug 11, 2023
2f3028f
Analysis: Add missing n-a to sdk override methods for edit post
ParaskP7 Aug 11, 2023
9f0e7fd
Analysis: Add missing n-a to sdk override methods for post settings tag
ParaskP7 Aug 11, 2023
319c59a
Analysis: Add missing n-a to sdk override methods for select categories
ParaskP7 Aug 11, 2023
0fde6d4
Analysis: Add missing n-a to sdk override methods for account settings
ParaskP7 Aug 11, 2023
1389ddd
Analysis: Add missing n-a to sdk override methods for blog preferences
ParaskP7 Aug 11, 2023
05fcb53
Analysis: Add missing n-a to sdk override methods for my profile
ParaskP7 Aug 11, 2023
ac5ac3e
Analysis: Add missing n-a to sdk override methods for site settings list
ParaskP7 Aug 11, 2023
adf4744
Analysis: Add missing n-a to sdk override methods for publicize list
ParaskP7 Aug 11, 2023
d099dda
Analysis: Add missing n-a to sdk override methods for reader comment lst
ParaskP7 Aug 11, 2023
5262961
Analysis: Add missing n-a to sdk override methods for reader photo view
ParaskP7 Aug 16, 2023
3f01766
Analysis: Add missing n-a to sdk override methods for reader post list
ParaskP7 Aug 16, 2023
8a4126e
Analysis: Suppress non constant res id lint warning for reader post list
ParaskP7 Aug 16, 2023
710aed5
Analysis: Add missing n-a to sdk override methods for reader post pager
ParaskP7 Aug 16, 2023
f40213e
Analysis: Add missing n-a to sdk override methods for reader subs
ParaskP7 Aug 16, 2023
54191a4
Analysis: Add missing n-a to sdk override methods for reader user list
ParaskP7 Aug 16, 2023
2a02c61
Analysis: Add missing n-a to sdk override methods for reader video view
ParaskP7 Aug 16, 2023
ec1c0b8
Analysis: Add missing n-a to sdk override methods for stock media picker
ParaskP7 Aug 16, 2023
37b1368
Analysis: Add missing n-a to sdk override methods for theme browser
ParaskP7 Aug 16, 2023
dd8c1bb
Refactor: Remove final keyword from item on options item selected method
ParaskP7 Aug 17, 2023
0b7aded
Refactor: Rename menu item param to item on on menu item action expand
ParaskP7 Aug 17, 2023
8405c3b
Refactor: Change modifier to protected on on activity result method
ParaskP7 Aug 17, 2023
5a7504a
Refactor: Rename s param to query on on query text submit method
ParaskP7 Aug 17, 2023
922e9d9
Refactor: Rename s param to new text on on query text change method
ParaskP7 Aug 17, 2023
0acc778
Refactor: Rename action mode param to mode on on create action mode
ParaskP7 Aug 17, 2023
6068d3a
Refactor: Rename action mode param to mode on on prepare action mode
ParaskP7 Aug 17, 2023
83b9261
Refactor: Rename action mode param to mode on on action item clicked
ParaskP7 Aug 17, 2023
975642e
Refactor: Rename menu item param to item on on action item clicked
ParaskP7 Aug 17, 2023
15fefd7
Refactor: Rename action mode param to mode on on destroy action mode
ParaskP7 Aug 17, 2023
a452dbf
Refactor: Remove final keyword from item on on bind viewHolder method
ParaskP7 Aug 17, 2023
00af6b7
Refactor: Make intent non null on on new intent function for kotlin
ParaskP7 Aug 17, 2023
4886871
Refactor: Rename view param to v on on click method
ParaskP7 Aug 17, 2023
e1dc640
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;

import org.wordpress.android.R;
Expand All @@ -14,7 +15,7 @@ public class SSLCertsViewActivity extends WebViewActivity {
public static final String CERT_DETAILS_KEYS = "CertDetails";

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getResources().getText(R.string.ssl_certificate_details));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -52,7 +54,7 @@ public class AddQuickPressShortcutActivity extends LocaleAwareActivity {
@Inject FluxCImageLoader mImageLoader;

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((WordPress) getApplication()).component().inject(this);

Expand All @@ -69,7 +71,7 @@ public void onCreate(Bundle savedInstanceState) {
}

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
getOnBackPressedDispatcher().onBackPressed();
return true;
Expand Down Expand Up @@ -131,7 +133,8 @@ private void buildDialog(final int position) {
dialogBuilder.setView(dialogView);

dialogBuilder.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
@Override
public void onClick(@Nullable DialogInterface dialog, int which) {
mkevins marked this conversation as resolved.
Show resolved Hide resolved
if (TextUtils.isEmpty(quickPressShortcutName.getText())) {
ToastUtils.showToast(AddQuickPressShortcutActivity.this, R.string.quickpress_add_error,
ToastUtils.Duration.LONG);
Expand Down Expand Up @@ -162,7 +165,8 @@ public void onClick(DialogInterface dialog, int which) {
});
dialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
// just let the dialog close
public void onClick(DialogInterface dialog, int which) {
@Override
public void onClick(@Nullable DialogInterface dialog, int which) {
}
});

Expand All @@ -171,7 +175,7 @@ public void onClick(DialogInterface dialog, int which) {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case RequestCodes.ADD_ACCOUNT:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.android.ui;

import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
Expand All @@ -15,6 +16,8 @@
import android.widget.ListView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.text.HtmlCompat;
Expand All @@ -34,7 +37,7 @@
*/
public class AppLogViewerActivity extends LocaleAwareActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.logviewer_activity);

Expand Down Expand Up @@ -76,7 +79,7 @@ public long getItemId(int position) {
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(int position, @Nullable View convertView, @Nullable ViewGroup parent) {
final LogViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.logviewer_listitem, parent, false);
Expand Down Expand Up @@ -136,15 +139,16 @@ private void copyAppLogToClipboard() {
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.app_log_viewer_menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly about this, but typically, final is used to prevent reassignment of the variable within the method. In this case, the method is rather simple, and item is only even used in the default call to the super method. But final parameters have no effect at the call site, so I'd generally be ok with keeping it - but in this case, since the method is very simple anyway, I'm also fine with removing it. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason I removed this final keyword is because I wanted every such method across the codebase to be consistent with each other.

Thus, and because I found very few occurrences of such final usage on such onOptionsItemSelected(...) methods across the whole codebase, that it is better to remove it here as well, rather than adding it everywhere else. No matter, I think it is better for us to use a consistent signature for such methods. Wdyt? 🤔

PS: Also, and since we don't have a documented way of using final, and since I rarely seen it being used, I think it is better to avoid adding it unnecessarily everywhere. Thus, I decided it might be better to remove it instead, whenever found on those @Override methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better for us to use a consistent signature for such methods

I agree with this, but my point above is that final is not really part of the method signature. That's what I meant by "no effect at the call site".

Since, in this instance, the usage is for such a simple method, I think it's ok to remove it. Generally speaking, though, the intention for using this is entirely compatible with keeping signatures consistent. final on a parameter only pertains to the usage of that reference within the method body, and is sometimes used to prevent reassignment of the variable. This can be a useful restriction in long / complex methods.

On this same topic, there are many parameter renaming changes, in which the commit message mentions this was done for the sake of consistent method signatures, but parameter names are not part of a methods signature in Java. I didn't see any issue with the renamings that you did, but was curious to know your motivation. Does it relate somehow to Kotlin?

To play devils advocate, I could envision deviating from the overriden super class parameter names for clarity's sake - to I don't think we should have a rule that all parameter names must match that of the super class. Especially because some super methods have inappropriately terse parameter names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this, but my point above is that final is not really part of the method signature. That's what I meant by "no effect at the call site".

👍

Generally speaking, though, the intention for using this is entirely compatible with keeping signatures consistent.

I agree with all your points @mkevins and apologies for the confusion here. What I meant with keeping signatures consistent wan't related to super vs implementing signature, but rather project wise, that is, so that when one is searching/copy-pasting such methods, that they are not seeing a mixture of both, some of them using a final, while others are not. Now, I agree that the usage of final is a case-by-case scenario, but on those specific cases I doubt that it was done like that (an assumption from my side). Instead, I think this was initial done purely because it is a best practice to use final as much and as widely as possible, and then, that was blindly copy-pasted thereafter. However, since us using final vs not using it at all hasn't been discussed, or agreed upon, and since me seeing and experiencing us not using final during our day-to-day work with Java, that is, unless the compiler complains or warns us about it, I was thinking it is better to remove those usages as well. This way, IMHO, the next person to copy-paste such method would not unnecessarily copy-paste the final as well, even if that means safer code... 🤷

The other way around for me would have been to add the final to every such @Override method. 🤔

Having said all the above, it is easier for me to plain ignore such changes if this will make it easier for you to review. I am only doing those to increase the consistency and make sure that we are using such @Override method consistently across the codebase, just to have make us that bit more consistent. But, I can stop doing that if that makes you uncomfortable as removing final is indeed less safe that having it there, or adding it everywhere missing, even if someone just copy-pasted that there from a previous such existing activity. 🤷

@SuppressLint("NonConstantResourceId")
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.text.TextUtils;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;

Expand Down Expand Up @@ -50,7 +51,7 @@ public class JetpackConnectionResultActivity extends LocaleAwareActivity {
@Inject Dispatcher mDispatcher;

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((WordPress) getApplication()).component().inject(this);

Expand Down Expand Up @@ -109,7 +110,7 @@ public void handleOnBackPressed() {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RequestCodes.JETPACK_LOGIN) {
if (resultCode == RESULT_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import org.wordpress.android.WordPress;
import org.wordpress.android.analytics.AnalyticsTracker;
import org.wordpress.android.fluxc.model.SiteModel;
Expand Down Expand Up @@ -81,7 +84,7 @@ private static void startJetpackConnectionFlow(Context context,
}

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE);
mSource = (JetpackConnectionSource) getIntent().getSerializableExtra(TRACKING_SOURCE_KEY);
// We need to get the site before calling super since it'll create the web client
Expand All @@ -96,7 +99,7 @@ protected WebViewClient createWebViewClient(List<String> allowedURL) {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == JETPACK_LOGIN && resultCode == RESULT_OK) {
JetpackConnectionWebViewActivity.startJetpackConnectionFlow(
Expand All @@ -113,19 +116,19 @@ protected void cancel() {
}

@Override
protected void onSaveInstanceState(Bundle outState) {
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(REDIRECT_PAGE_STATE_ITEM, mWebViewClient.getRedirectPage());
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mWebViewClient.setRedirectPage(savedInstanceState.getString(REDIRECT_PAGE_STATE_ITEM));
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.TaskStackBuilder;
import androidx.preference.PreferenceManager;

Expand Down Expand Up @@ -56,14 +57,14 @@ public class ShareIntentReceiverActivity extends LocaleAwareActivity implements
private ArrayList<Uri> mLocalMediaUris = new ArrayList<>();

@Override
protected void onNewIntent(Intent intent) {
protected void onNewIntent(@NonNull Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
refreshContent();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((WordPress) getApplication()).component().inject(this);
setContentView(R.layout.share_intent_receiver_activity);
Expand Down Expand Up @@ -123,7 +124,7 @@ private void loadState(Bundle savedInstanceState) {
}

@Override
public void onSaveInstanceState(Bundle outState) {
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(KEY_SELECTED_SITE_LOCAL_ID, mClickedSiteLocalId);
outState.putString(KEY_SHARE_ACTION_ID, mShareActionName);
Expand All @@ -136,7 +137,7 @@ private int loadLastUsedBlogLocalId() {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RequestCodes.DO_LOGIN) {
if (resultCode == RESULT_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import android.webkit.WebView;
import android.widget.ProgressBar;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import org.wordpress.android.fluxc.utils.MediaUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
Expand Down Expand Up @@ -91,7 +94,7 @@ public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathC
return true;
}

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent intent) {
Uri[] selectedUris = null;

if (intent != null && resultCode == RESULT_OK && requestCode == WEB_CHROME_CLIENT_FILE_PICKER) {
Expand All @@ -118,6 +121,6 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
}

public interface OnShowFileChooserListener {
void startActivityForFileChooserResult(Intent intent, int requestCode);
void startActivityForFileChooserResult(@NonNull Intent intent, int requestCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.widget.TextView;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -155,7 +156,7 @@ public class WPWebViewActivity extends WebViewActivity implements ErrorManagedWe
private WPWebChromeClientWithFileChooser mWPWebChromeClientWithFileChooser;

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
((WordPress) getApplication()).component().inject(this);
super.onCreate(savedInstanceState);

Expand Down Expand Up @@ -853,7 +854,7 @@ private boolean isActionableDirectUsage() {
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
super.onCreateOptionsMenu(menu);

MenuInflater inflater = getMenuInflater();
Expand All @@ -862,7 +863,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
}

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (mWebView == null) {
return false;
}
Expand Down Expand Up @@ -935,15 +936,15 @@ public void onCookieProgressDialogCancelled() {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (mWPWebChromeClientWithFileChooser != null) {
mWPWebChromeClientWithFileChooser.onActivityResult(requestCode, resultCode, data);
}
}

@Override
public void startActivityForFileChooserResult(Intent intent, int requestCode) {
public void startActivityForFileChooserResult(@NonNull Intent intent, int requestCode) {
startActivityForResult(intent, requestCode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.webkit.WebView;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;

Expand All @@ -29,7 +31,7 @@ public abstract class WebViewActivity extends LocaleAwareActivity {
protected WebView mWebView;

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_PROGRESS);

super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -82,7 +84,7 @@ protected void loadContent() {
* save the webView state with the bundle so it can be restored
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
protected void onSaveInstanceState(@NonNull Bundle outState) {
mWebView.saveState(outState);
super.onSaveInstanceState(outState);
}
Expand All @@ -91,7 +93,7 @@ protected void onSaveInstanceState(Bundle outState) {
* restore the webView state saved above
*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mWebView.restoreState(savedInstanceState);
}
Expand Down Expand Up @@ -161,7 +163,7 @@ public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
}

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
cancel();
finish();
Expand Down
Loading