This seems to fix contact edition issue + added refresher on contact list
This commit is contained in:
parent
9d66458f36
commit
fc5da7f57d
4 changed files with 26 additions and 8 deletions
|
@ -91,6 +91,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
Serializable obj = getArguments().getSerializable("Contact");
|
||||
if (obj != null) {
|
||||
mContact = (LinphoneContact) obj;
|
||||
mContact.createLinphoneTagIfNeeded();
|
||||
mIsNewContact = false;
|
||||
if (getArguments().getString("NewSipAdress") != null) {
|
||||
mNewSipOrNumberToAdd = getArguments().getString("NewSipAdress");
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.widget.TextView;
|
|||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.linphone.LinphoneActivity;
|
||||
|
@ -61,6 +62,7 @@ public class ContactsFragment extends Fragment
|
|||
private Context mContext;
|
||||
private SelectableHelper mSelectionHelper;
|
||||
private ContactsAdapter mContactAdapter;
|
||||
private SwipeRefreshLayout mContactsRefresher;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
|
@ -88,6 +90,15 @@ public class ContactsFragment extends Fragment
|
|||
mLinphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
||||
mContactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||
mNewContact = view.findViewById(R.id.newContact);
|
||||
mContactsRefresher = view.findViewById(R.id.contactsListRefresher);
|
||||
|
||||
mContactsRefresher.setOnRefreshListener(
|
||||
new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
ContactsManager.getInstance().fetchContactsAsync();
|
||||
}
|
||||
});
|
||||
|
||||
mAllContacts.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
|
@ -364,6 +375,7 @@ public class ContactsFragment extends Fragment
|
|||
}
|
||||
}
|
||||
mContactsFetchInProgress.setVisibility(View.GONE);
|
||||
mContactsRefresher.setRefreshing(false);
|
||||
}
|
||||
|
||||
private void invalidate() {
|
||||
|
|
|
@ -776,7 +776,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
&& ContactsManager.getInstance().hasContactsAccess()
|
||||
&& mChangesToCommit.size() > 0) {
|
||||
try {
|
||||
createLinphoneTagIfNeeded();
|
||||
LinphoneService.instance()
|
||||
.getContentResolver()
|
||||
.applyBatch(ContactsContract.AUTHORITY, mChangesToCommit);
|
||||
|
@ -1077,7 +1076,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
return result;
|
||||
}
|
||||
|
||||
private void createLinphoneTagIfNeeded() {
|
||||
public void createLinphoneTagIfNeeded() {
|
||||
if (LinphoneManager.getInstance()
|
||||
.getContext()
|
||||
.getResources()
|
||||
|
|
|
@ -110,14 +110,20 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!--android:fastScrollAlwaysVisible="true"-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contactsList"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/contactsListRefresher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@color/colorE"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
android:dividerHeight="1dp" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contactsList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@color/colorE"
|
||||
|
||||
android:dividerHeight="1dp" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/contactsFetchInProgress"
|
||||
|
|
Loading…
Reference in a new issue