mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 20:45:29 +03:00
Fix possible crashes
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
d781247074
commit
220a4b292d
2 changed files with 64 additions and 50 deletions
|
@ -2,25 +2,35 @@
|
|||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="5">
|
||||
<list size="10">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="4">
|
||||
<list size="9">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
|
|
|
@ -258,59 +258,63 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
if (!isPublicCall && adapter.getSelectedPositions().size() == 1) {
|
||||
String roomType = "1";
|
||||
|
||||
if ("groups".equals(((UserItem) adapter.getItem(adapter.getSelectedPositions().get(0))).getModel().getSource())) {
|
||||
int firstSelectedPosition = adapter.getSelectedPositions().get(0);
|
||||
Object selectedObject = adapter.getItem(firstSelectedPosition);
|
||||
if (selectedObject != null && "groups".equals(((UserItem) selectedObject).getModel().getSource())) {
|
||||
roomType = "2";
|
||||
}
|
||||
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), roomType,
|
||||
((UserItem) adapter.getItem(adapter.getSelectedPositions().get(0))).getModel().getUserId(), null);
|
||||
ncApi.createRoom(credentials,
|
||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
if (selectedObject != null) {
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), roomType,
|
||||
((UserItem) selectedObject).getModel().getUserId(), null);
|
||||
ncApi.createRoom(credentials,
|
||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOverall roomOverall) {
|
||||
Intent conversationIntent = new Intent(getActivity(), MagicCallActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
|
||||
bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId());
|
||||
|
||||
if (currentUser.hasSpreedCapabilityWithName("chat-v2")) {
|
||||
bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,
|
||||
roomOverall.getOcs().getData().getDisplayName());
|
||||
conversationIntent.putExtras(bundle);
|
||||
getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler())));
|
||||
} else {
|
||||
conversationIntent.putExtras(bundle);
|
||||
startActivity(conversationIntent);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!isDestroyed() && !isBeingDestroyed()) {
|
||||
getRouter().popCurrentController();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
@Override
|
||||
public void onNext(RoomOverall roomOverall) {
|
||||
Intent conversationIntent = new Intent(getActivity(), MagicCallActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
|
||||
bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.getOcs().getData().getRoomId());
|
||||
|
||||
}
|
||||
if (currentUser.hasSpreedCapabilityWithName("chat-v2")) {
|
||||
bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,
|
||||
roomOverall.getOcs().getData().getDisplayName());
|
||||
conversationIntent.putExtras(bundle);
|
||||
getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler())));
|
||||
} else {
|
||||
conversationIntent.putExtras(bundle);
|
||||
startActivity(conversationIntent);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!isDestroyed() && !isBeingDestroyed()) {
|
||||
getRouter().popCurrentController();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -375,7 +379,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
public void onCreateOptionsMenu(Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_contacts, menu);
|
||||
searchItem = menu.findItem(R.id.action_search);
|
||||
|
@ -385,7 +389,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
public void onPrepareOptionsMenu(@NonNull Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
searchItem.setVisible(contactItems.size() > 0);
|
||||
checkAndHandleDoneMenuItem();
|
||||
|
|
Loading…
Reference in a new issue