mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Add null and cast checks. Should fix https://github.com/austinhuang0131/barinsta/issues/278
This commit is contained in:
parent
d0c8e9f28c
commit
5fdeeb7301
@ -18,8 +18,8 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewParent;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -476,9 +476,16 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||||||
if (text != null) {
|
if (text != null) {
|
||||||
binding.commentText.setText("");
|
binding.commentText.setText("");
|
||||||
} else {
|
} else {
|
||||||
final LinearLayout dim = (LinearLayout) binding.messageList.findViewWithTag(directItemModel).getParent();
|
final View viewWithTag = binding.messageList.findViewWithTag(directItemModel);
|
||||||
if (dim.findViewById(R.id.liked_container) != null) {
|
if (viewWithTag != null) {
|
||||||
dim.findViewById(R.id.liked_container).setVisibility(delete ? View.GONE : View.VISIBLE);
|
final ViewParent dim = viewWithTag.getParent();
|
||||||
|
if (dim instanceof View) {
|
||||||
|
final View dimView = (View) dim;
|
||||||
|
final View likedContainer = dimView.findViewById(R.id.liked_container);
|
||||||
|
if (likedContainer != null) {
|
||||||
|
likedContainer.setVisibility(delete ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
directItemModel.setLiked();
|
directItemModel.setLiked();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user