Skip to content

Commit

Permalink
Fixes signalapp#13852 - Contacts Refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagar0-0 committed Jan 3, 2025
1 parent 517aeee commit 70a88eb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void onFindContactsClicked() {

@Override
public void onRefreshContactsClicked() {
if (onRefreshListener != null) {
if (onRefreshListener != null && !isRefreshing()) {
setRefreshing(true);
onRefreshListener.onRefresh();
}
Expand Down Expand Up @@ -570,6 +570,10 @@ public void setRefreshing(boolean refreshing) {
swipeRefresh.setRefreshing(refreshing);
}

public boolean isRefreshing() {
return swipeRefresh.isRefreshing();
}

public void reset() {
contactSearchMediator.clearSelection();
fastScroller.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
}

private void handleManualRefresh() {
contactsFragment.setRefreshing(true);
onRefresh();
if (!contactsFragment.isRefreshing()) {
contactsFragment.setRefreshing(true);
onRefresh();
}
}

private void handleCreateGroup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ class NewCallActivity : ContactSelectionActivity(), ContactSelectionListFragment
startActivity(Intent(this, InviteActivity::class.java))
}

private fun handleManualRefresh() {
if(!contactsFragment.isRefreshing) {
contactsFragment.isRefreshing = true
onRefresh()
}
}

private inner class NewCallMenuProvider : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.new_call_menu, menu)
Expand All @@ -122,7 +129,7 @@ class NewCallActivity : ContactSelectionActivity(), ContactSelectionListFragment
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
when (menuItem.itemId) {
android.R.id.home -> ActivityCompat.finishAfterTransition(this@NewCallActivity)
R.id.menu_refresh -> onRefresh()
R.id.menu_refresh -> handleManualRefresh()
R.id.menu_invite -> startActivity(Intent(this@NewCallActivity, InviteActivity::class.java))
}

Expand Down

0 comments on commit 70a88eb

Please sign in to comment.