diff --git a/src/org/kde/kdeconnect/Device.java b/src/org/kde/kdeconnect/Device.java index ceb70426..f73dbb32 100644 --- a/src/org/kde/kdeconnect/Device.java +++ b/src/org/kde/kdeconnect/Device.java @@ -19,6 +19,7 @@ import android.util.Base64; import android.util.Log; import androidx.annotation.AnyThread; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; import androidx.core.app.NotificationCompat; @@ -112,6 +113,7 @@ public class Device implements BaseLink.PacketReceiver { return Computer; //Default } + @NonNull public String toString() { switch (this) { case Tablet: diff --git a/src/org/kde/kdeconnect/Helpers/LongSummaryPreferenceCategory.java b/src/org/kde/kdeconnect/Helpers/LongSummaryPreferenceCategory.java index 9b688e0d..9d35a315 100644 --- a/src/org/kde/kdeconnect/Helpers/LongSummaryPreferenceCategory.java +++ b/src/org/kde/kdeconnect/Helpers/LongSummaryPreferenceCategory.java @@ -10,6 +10,7 @@ import android.content.Context; import android.util.AttributeSet; import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceViewHolder; @@ -24,7 +25,7 @@ public class LongSummaryPreferenceCategory extends PreferenceCategory { } @Override - public void onBindViewHolder(PreferenceViewHolder holder) { + public void onBindViewHolder(@NonNull PreferenceViewHolder holder) { super.onBindViewHolder(holder); TextView summary = (TextView) holder.findViewById(android.R.id.summary); summary.setMaxLines(3); diff --git a/src/org/kde/kdeconnect/Helpers/TelephonyHelper.java b/src/org/kde/kdeconnect/Helpers/TelephonyHelper.java index 05efb15a..4d7174c2 100644 --- a/src/org/kde/kdeconnect/Helpers/TelephonyHelper.java +++ b/src/org/kde/kdeconnect/Helpers/TelephonyHelper.java @@ -420,6 +420,7 @@ public class TelephonyHelper { this.subscriptionID = subscriptionID; } + @NonNull @Override public String toString() { return number; diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpSettingsFragment.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpSettingsFragment.java index f45143bb..8d4311a7 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpSettingsFragment.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpSettingsFragment.java @@ -128,8 +128,9 @@ public class SftpSettingsFragment } } + @NonNull @Override - protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { + protected RecyclerView.Adapter onCreateAdapter(@NonNull PreferenceScreen preferenceScreen) { if (savedActionModeState != null) { getListView().post(this::restoreActionMode); } @@ -162,7 +163,7 @@ public class SftpSettingsFragment } @Override - public void onDisplayPreferenceDialog(Preference preference) { + public void onDisplayPreferenceDialog(@NonNull Preference preference) { if (preference instanceof StoragePreference) { StoragePreferenceDialogFragment fragment = StoragePreferenceDialogFragment.newInstance(preference.getKey()); fragment.setTargetFragment(this, 0); @@ -174,7 +175,7 @@ public class SftpSettingsFragment } @Override - public void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); try { @@ -340,7 +341,7 @@ public class SftpSettingsFragment } @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { + public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) { SftpPlugin.StorageInfo newStorageInfo = (SftpPlugin.StorageInfo) newValue; ListIterator it = storageInfoList.listIterator(); diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreference.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreference.java index c356a5c8..76a7685c 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreference.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreference.java @@ -96,7 +96,7 @@ public class StoragePreference extends DialogPreference { } @Override - public void onBindViewHolder(PreferenceViewHolder holder) { + public void onBindViewHolder(@NonNull PreferenceViewHolder holder) { super.onBindViewHolder(holder); checkbox = (CheckBox) holder.itemView.findViewById(R.id.checkbox); diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java index 573110e3..b51234f8 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java @@ -104,7 +104,7 @@ public class StoragePreferenceDialogFragment extends PreferenceDialogFragmentCom } @Override - protected void onBindDialogView(View view) { + protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); binding = FragmentStoragePreferenceDialogBinding.bind(view); diff --git a/src/org/kde/kdeconnect/UserInterface/AlertDialogFragment.java b/src/org/kde/kdeconnect/UserInterface/AlertDialogFragment.java index 00e42d02..de1ce766 100644 --- a/src/org/kde/kdeconnect/UserInterface/AlertDialogFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/AlertDialogFragment.java @@ -100,7 +100,7 @@ public class AlertDialogFragment extends DialogFragment implements DialogInterfa } @Override - public void onCancel(DialogInterface dialog) { + public void onCancel(@NonNull DialogInterface dialog) { super.onCancel(dialog); if (callback != null) { @@ -109,7 +109,7 @@ public class AlertDialogFragment extends DialogFragment implements DialogInterfa } @Override - public void onDismiss(DialogInterface dialog) { + public void onDismiss(@NonNull DialogInterface dialog) { super.onDismiss(dialog); if (callback != null) { diff --git a/src/org/kde/kdeconnect/UserInterface/MainActivity.java b/src/org/kde/kdeconnect/UserInterface/MainActivity.java index ae542d7a..ae72cc53 100644 --- a/src/org/kde/kdeconnect/UserInterface/MainActivity.java +++ b/src/org/kde/kdeconnect/UserInterface/MainActivity.java @@ -368,7 +368,7 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences } @Override - protected void onSaveInstanceState(Bundle outState) { + protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putString(STATE_SELECTED_DEVICE, mCurrentDevice); outState.putInt(STATE_SELECTED_MENU_ENTRY, mCurrentMenuEntry); diff --git a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java index 7b4b24c4..a6740835 100644 --- a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java @@ -130,7 +130,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { super.onAttach(context); mActivity = ((MainActivity) getActivity()); } @@ -286,7 +286,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb } @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.pairing, menu); } diff --git a/src/org/kde/kdeconnect/UserInterface/PluginPreference.java b/src/org/kde/kdeconnect/UserInterface/PluginPreference.java index 1a2f0096..37a8ac8e 100644 --- a/src/org/kde/kdeconnect/UserInterface/PluginPreference.java +++ b/src/org/kde/kdeconnect/UserInterface/PluginPreference.java @@ -49,7 +49,7 @@ setIcon(android.R.color.transparent); } @Override - public void onBindViewHolder(PreferenceViewHolder holder) { + public void onBindViewHolder(@NonNull PreferenceViewHolder holder) { super.onBindViewHolder(holder); View.OnClickListener toggleListener = v -> { diff --git a/src/org/kde/kdeconnect/UserInterface/PluginSettingsListFragment.java b/src/org/kde/kdeconnect/UserInterface/PluginSettingsListFragment.java index fc77c159..ac058972 100644 --- a/src/org/kde/kdeconnect/UserInterface/PluginSettingsListFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/PluginSettingsListFragment.java @@ -93,8 +93,9 @@ public class PluginSettingsListFragment extends PreferenceFragmentCompat { }); } + @NonNull @Override - protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { + protected RecyclerView.Adapter onCreateAdapter(@NonNull PreferenceScreen preferenceScreen) { RecyclerView.Adapter adapter = super.onCreateAdapter(preferenceScreen); /* @@ -144,7 +145,7 @@ public class PluginSettingsListFragment extends PreferenceFragmentCompat { } @Override - public void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); Parcelable layoutManagerState = recyclerViewLayoutManagerState; diff --git a/src/org/kde/kdeconnect/UserInterface/SettingsFragment.java b/src/org/kde/kdeconnect/UserInterface/SettingsFragment.java index 9d2d2656..896d0be7 100644 --- a/src/org/kde/kdeconnect/UserInterface/SettingsFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/SettingsFragment.java @@ -32,6 +32,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { private EditTextPreference renameDevice; + @NonNull @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (getActivity() != null) {