Messaging: Nullability

Change-Id: I8bcde2a868a9c8989971d056be24ff4986e4f8f3
This commit is contained in:
Michael W
2024-12-26 14:55:12 +01:00
parent e35d385149
commit c1b4aa4dfe
82 changed files with 372 additions and 120 deletions
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,8 @@ import android.content.res.Resources;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import android.text.Editable;
import android.text.Html;
@@ -284,7 +287,8 @@ public class ComposeMessageView extends LinearLayout
});
mSendButton.setAccessibilityDelegate(new AccessibilityDelegate() {
@Override
public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
public void onPopulateAccessibilityEvent(@NonNull View host,
@NonNull AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(host, event);
// When the send button is long clicked, we want TalkBack to announce the real
// action (select SIM or edit subject), as opposed to "long press send button."
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,8 @@ import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import android.text.TextUtils;
import android.view.MenuItem;
@@ -119,7 +122,7 @@ public class ConversationActivity extends BugleActionBarActivity
}
@Override
protected void onSaveInstanceState(final Bundle outState) {
protected void onSaveInstanceState(@NonNull final Bundle outState) {
super.onSaveInstanceState(outState);
// After onSaveInstanceState() is called, future changes to mUiState won't update the UI
// anymore, because fragment transactions are not allowed past this point.
@@ -187,7 +190,7 @@ public class ConversationActivity extends BugleActionBarActivity
}
@Override
public boolean onOptionsItemSelected(final MenuItem menuItem) {
public boolean onOptionsItemSelected(@NonNull final MenuItem menuItem) {
if (super.onOptionsItemSelected(menuItem)) {
return true;
}
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,8 @@ package com.android.messaging.ui.conversation;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.android.messaging.ui.contact.ContactPickerFragment;
import com.android.messaging.util.Assert;
import com.google.common.annotations.VisibleForTesting;
@@ -285,6 +288,7 @@ public class ConversationActivityUiState implements Parcelable, Cloneable {
}
};
@NonNull
@Override
protected ConversationActivityUiState clone() {
try {
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,8 @@ import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.drawable.StateListDrawable;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
@@ -169,7 +172,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
}
@Override
public void onScrollStateChanged(final RecyclerView view, final int newState) {
public void onScrollStateChanged(@NonNull final RecyclerView view, final int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
// Only show the scrollbar once the user starts scrolling
if (!mVisible && isEnabled()) {
@@ -257,7 +260,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
}
@Override
public void onScrolled(final RecyclerView view, final int dx, final int dy) {
public void onScrolled(@NonNull final RecyclerView view, final int dx, final int dy) {
updateScrollPos();
}
@@ -315,7 +318,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
}
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
if (!mVisible) {
return false;
}
@@ -357,7 +360,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
if (!mDragging) {
return;
}
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +44,8 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.core.text.BidiFormatter;
import androidx.core.text.TextDirectionHeuristicsCompat;
@@ -245,7 +248,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
private int mScrollState = RecyclerView.SCROLL_STATE_IDLE;
@Override
public void onScrollStateChanged(final RecyclerView view, final int newState) {
public void onScrollStateChanged(@NonNull final RecyclerView view, final int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
// Reset scroll states.
mCumulativeScrollDelta = 0;
@@ -257,7 +260,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
}
@Override
public void onScrolled(final RecyclerView view, final int dx, final int dy) {
public void onScrolled(@NonNull final RecyclerView view, final int dx, final int dy) {
if (mScrollState == RecyclerView.SCROLL_STATE_DRAGGING &&
!mScrollToDismissHandled) {
mCumulativeScrollDelta += dy;
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,8 @@ import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.android.messaging.R;
import com.android.messaging.annotation.VisibleForAnimation;
import com.android.messaging.datamodel.data.ConversationMessageBubbleData;
@@ -104,11 +107,11 @@ public class ConversationMessageBubbleView extends LinearLayout {
mAnimator.setDuration(UiUtils.MEDIAPICKER_TRANSITION_DURATION);
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
public void onAnimationStart(@NonNull Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
public void onAnimationEnd(@NonNull Animator animator) {
mAnimator = null;
mMorphedWidth = 0;
// Allow the bubble to resize if, for example, the status text changed during
@@ -120,11 +123,11 @@ public class ConversationMessageBubbleView extends LinearLayout {
}
@Override
public void onAnimationCancel(Animator animator) {
public void onAnimationCancel(@NonNull Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
public void onAnimationRepeat(@NonNull Animator animator) {
}
});
mAnimator.start();
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,8 @@ import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ListView;
import androidx.annotation.NonNull;
import com.android.messaging.R;
import com.android.messaging.datamodel.data.SubscriptionListData;
import com.android.messaging.datamodel.data.SubscriptionListData.SubscriptionListEntry;
@@ -140,8 +143,10 @@ public class SimSelectorView extends FrameLayout implements SimSelectorItemView.
notifyDataSetChanged();
}
@NonNull
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
public View getView(final int position, final View convertView,
@NonNull final ViewGroup parent) {
SimSelectorItemView itemView;
if (convertView != null && convertView instanceof SimSelectorItemView) {
itemView = (SimSelectorItemView) convertView;