kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash when entering conversation search through bottom sheet.
rodzic
5423ed1d91
commit
ef9f1e9884
|
@ -384,7 +384,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
initializeMessageRequestViewModel();
|
initializeMessageRequestViewModel();
|
||||||
initializeListAdapter();
|
initializeListAdapter();
|
||||||
|
|
||||||
// TODO [alex] LargeScreenSupport -- conversationViewModel.getSearchQuery().observe(getViewLifecycleOwner(), this::onSearchQueryUpdated);
|
conversationViewModel.getSearchQuery().observe(getViewLifecycleOwner(), this::onSearchQueryUpdated);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
return getListAdapter().isTypingViewEnabled();
|
return getListAdapter().isTypingViewEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSearchQueryUpdated(@Nullable String query) {
|
private void onSearchQueryUpdated(@Nullable String query) {
|
||||||
if (getListAdapter() != null) {
|
if (getListAdapter() != null) {
|
||||||
getListAdapter().onSearchQueryUpdated(query);
|
getListAdapter().onSearchQueryUpdated(query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1020,8 +1020,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
searchViewModel.onQueryUpdated(query, threadId, true);
|
searchViewModel.onQueryUpdated(query, threadId, true);
|
||||||
searchNav.showLoading();
|
searchNav.showLoading();
|
||||||
// TODO [alex] LargeScreenSupport -- Set search query on viewModel
|
viewModel.setSearchQuery(query);
|
||||||
fragment.onSearchQueryUpdated(query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,8 +1028,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
public boolean onQueryTextChange(String query) {
|
public boolean onQueryTextChange(String query) {
|
||||||
searchViewModel.onQueryUpdated(query, threadId, false);
|
searchViewModel.onQueryUpdated(query, threadId, false);
|
||||||
searchNav.showLoading();
|
searchNav.showLoading();
|
||||||
// TODO [alex] LargeScreenSupport -- Set search query on viewModel
|
viewModel.setSearchQuery(query);
|
||||||
fragment.onSearchQueryUpdated(query);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1059,8 +1057,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
searchViewModel.onSearchClosed();
|
searchViewModel.onSearchClosed();
|
||||||
searchNav.setVisibility(View.GONE);
|
searchNav.setVisibility(View.GONE);
|
||||||
inputPanel.setHideForSearch(false);
|
inputPanel.setHideForSearch(false);
|
||||||
// TODO [alex] LargeScreenSupport -- Set search query on viewModel
|
viewModel.setSearchQuery(null);
|
||||||
fragment.onSearchQueryUpdated(null);
|
|
||||||
setBlockedUserState(recipient.get(), isSecureText, isDefaultSms);
|
setBlockedUserState(recipient.get(), isSecureText, isDefaultSms);
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Application;
|
||||||
|
|
||||||
import androidx.annotation.MainThread;
|
import androidx.annotation.MainThread;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.LiveDataReactiveStreams;
|
import androidx.lifecycle.LiveDataReactiveStreams;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
@ -90,6 +91,7 @@ public class ConversationViewModel extends ViewModel {
|
||||||
private final Store<ThreadAnimationState> threadAnimationStateStore;
|
private final Store<ThreadAnimationState> threadAnimationStateStore;
|
||||||
private final Observer<ThreadAnimationState> threadAnimationStateStoreDriver;
|
private final Observer<ThreadAnimationState> threadAnimationStateStoreDriver;
|
||||||
private final NotificationProfilesRepository notificationProfilesRepository;
|
private final NotificationProfilesRepository notificationProfilesRepository;
|
||||||
|
private final MutableLiveData<String> searchQuery;
|
||||||
|
|
||||||
private final Map<GroupId, Set<Recipient>> sessionMemberCache = new HashMap<>();
|
private final Map<GroupId, Set<Recipient>> sessionMemberCache = new HashMap<>();
|
||||||
|
|
||||||
|
@ -115,6 +117,7 @@ public class ConversationViewModel extends ViewModel {
|
||||||
this.conversationTopMargin = Transformations.distinctUntilChanged(LiveDataUtil.combineLatest(toolbarBottom, inlinePlayerHeight, Integer::sum));
|
this.conversationTopMargin = Transformations.distinctUntilChanged(LiveDataUtil.combineLatest(toolbarBottom, inlinePlayerHeight, Integer::sum));
|
||||||
this.threadAnimationStateStore = new Store<>(new ThreadAnimationState(-1L, null, false));
|
this.threadAnimationStateStore = new Store<>(new ThreadAnimationState(-1L, null, false));
|
||||||
this.notificationProfilesRepository = new NotificationProfilesRepository();
|
this.notificationProfilesRepository = new NotificationProfilesRepository();
|
||||||
|
this.searchQuery = new MutableLiveData<>();
|
||||||
|
|
||||||
LiveData<Recipient> recipientLiveData = LiveDataUtil.mapAsync(recipientId, Recipient::resolved);
|
LiveData<Recipient> recipientLiveData = LiveDataUtil.mapAsync(recipientId, Recipient::resolved);
|
||||||
LiveData<ThreadAndRecipient> threadAndRecipient = LiveDataUtil.combineLatest(threadId, recipientLiveData, ThreadAndRecipient::new);
|
LiveData<ThreadAndRecipient> threadAndRecipient = LiveDataUtil.combineLatest(threadId, recipientLiveData, ThreadAndRecipient::new);
|
||||||
|
@ -243,6 +246,14 @@ public class ConversationViewModel extends ViewModel {
|
||||||
this.threadId.postValue(-1L);
|
this.threadId.postValue(-1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSearchQuery(@Nullable String query) {
|
||||||
|
searchQuery.setValue(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull LiveData<String> getSearchQuery() {
|
||||||
|
return searchQuery;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull LiveData<Integer> getConversationTopMargin() {
|
@NonNull LiveData<Integer> getConversationTopMargin() {
|
||||||
return conversationTopMargin;
|
return conversationTopMargin;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue