Merge pull request #378 from nextcloud/fix-crashes

Fix a few crashes
This commit is contained in:
Mario Đanić 2018-12-11 10:29:38 +01:00 committed by GitHub
commit 8f88dc9c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 14 deletions

View File

@ -431,7 +431,7 @@ public class CallNotificationController extends BaseController {
.into(new SimpleTarget<Bitmap>() { .into(new SimpleTarget<Bitmap>() {
@Override @Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) { public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
if (getActivity() != null) { if (getActivity() != null && avatarImageView != null) {
avatarImageView.setImageBitmap(TransformationUtils.circleCrop(GlideApp.get avatarImageView.setImageBitmap(TransformationUtils.circleCrop(GlideApp.get
(getActivity()).getBitmapPool(), resource, avatarSize, avatarSize)); (getActivity()).getBitmapPool(), resource, avatarSize, avatarSize));
} }

View File

@ -161,16 +161,18 @@ public class ConversationInfoController extends BaseController {
} }
private void setupAdapter() { private void setupAdapter() {
if (adapter == null) { if (adapter == null && getActivity() != null) {
adapter = new FlexibleAdapter<>(recyclerViewItems, getActivity(), true); adapter = new FlexibleAdapter<>(recyclerViewItems, getActivity(), true);
} }
if (recyclerView != null && getActivity() != null) {
SmoothScrollLinearLayoutManager layoutManager = SmoothScrollLinearLayoutManager layoutManager =
new SmoothScrollLinearLayoutManager(getActivity()); new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager); recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
} }
}
private void handleParticipants(List<Participant> participants) { private void handleParticipants(List<Participant> participants) {
UserItem userItem; UserItem userItem;
@ -260,13 +262,22 @@ public class ConversationInfoController extends BaseController {
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
} }
if (nameCategoryView != null) {
nameCategoryView.setVisibility(View.VISIBLE); nameCategoryView.setVisibility(View.VISIBLE);
}
if (conversationDisplayName != null) {
conversationDisplayName.setText(conversation.getDisplayName()); conversationDisplayName.setText(conversation.getDisplayName());
}
loadConversationAvatar(); loadConversationAvatar();
if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) { if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) {
if (messageNotificationLevel != null) {
messageNotificationLevel.setEnabled(true); messageNotificationLevel.setEnabled(true);
messageNotificationLevel.setAlpha(1.0f); messageNotificationLevel.setAlpha(1.0f);
}
if (!conversation.getNotificationLevel().equals(Conversation.NotificationLevel.DEFAULT)) { if (!conversation.getNotificationLevel().equals(Conversation.NotificationLevel.DEFAULT)) {
String stringValue; String stringValue;
switch (new EnumNotificationLevelConverter().convertToInt(conversation.getNotificationLevel())) { switch (new EnumNotificationLevelConverter().convertToInt(conversation.getNotificationLevel())) {

View File

@ -616,13 +616,19 @@ public class SettingsController extends BaseController {
} else { } else {
switch (newValue) { switch (newValue) {
case "HTTP": case "HTTP":
if (proxyPortEditText != null) {
proxyPortEditText.setValue("3128"); proxyPortEditText.setValue("3128");
}
break; break;
case "DIRECT": case "DIRECT":
if (proxyPortEditText != null) {
proxyPortEditText.setValue("8080"); proxyPortEditText.setValue("8080");
}
break; break;
case "SOCKS": case "SOCKS":
if (proxyPortEditText != null) {
proxyPortEditText.setValue("1080"); proxyPortEditText.setValue("1080");
}
break; break;
default: default:
break; break;