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");
|
Serializable obj = getArguments().getSerializable("Contact");
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
mContact = (LinphoneContact) obj;
|
mContact = (LinphoneContact) obj;
|
||||||
|
mContact.createLinphoneTagIfNeeded();
|
||||||
mIsNewContact = false;
|
mIsNewContact = false;
|
||||||
if (getArguments().getString("NewSipAdress") != null) {
|
if (getArguments().getString("NewSipAdress") != null) {
|
||||||
mNewSipOrNumberToAdd = getArguments().getString("NewSipAdress");
|
mNewSipOrNumberToAdd = getArguments().getString("NewSipAdress");
|
||||||
|
|
|
@ -34,6 +34,7 @@ import android.widget.TextView;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.linphone.LinphoneActivity;
|
import org.linphone.LinphoneActivity;
|
||||||
|
@ -61,6 +62,7 @@ public class ContactsFragment extends Fragment
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private SelectableHelper mSelectionHelper;
|
private SelectableHelper mSelectionHelper;
|
||||||
private ContactsAdapter mContactAdapter;
|
private ContactsAdapter mContactAdapter;
|
||||||
|
private SwipeRefreshLayout mContactsRefresher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
|
@ -88,6 +90,15 @@ public class ContactsFragment extends Fragment
|
||||||
mLinphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
mLinphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
||||||
mContactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
mContactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||||
mNewContact = view.findViewById(R.id.newContact);
|
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(
|
mAllContacts.setOnClickListener(
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
|
@ -364,6 +375,7 @@ public class ContactsFragment extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mContactsFetchInProgress.setVisibility(View.GONE);
|
mContactsFetchInProgress.setVisibility(View.GONE);
|
||||||
|
mContactsRefresher.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invalidate() {
|
private void invalidate() {
|
||||||
|
|
|
@ -776,7 +776,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
&& ContactsManager.getInstance().hasContactsAccess()
|
&& ContactsManager.getInstance().hasContactsAccess()
|
||||||
&& mChangesToCommit.size() > 0) {
|
&& mChangesToCommit.size() > 0) {
|
||||||
try {
|
try {
|
||||||
createLinphoneTagIfNeeded();
|
|
||||||
LinphoneService.instance()
|
LinphoneService.instance()
|
||||||
.getContentResolver()
|
.getContentResolver()
|
||||||
.applyBatch(ContactsContract.AUTHORITY, mChangesToCommit);
|
.applyBatch(ContactsContract.AUTHORITY, mChangesToCommit);
|
||||||
|
@ -1077,7 +1076,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLinphoneTagIfNeeded() {
|
public void createLinphoneTagIfNeeded() {
|
||||||
if (LinphoneManager.getInstance()
|
if (LinphoneManager.getInstance()
|
||||||
.getContext()
|
.getContext()
|
||||||
.getResources()
|
.getResources()
|
||||||
|
|
|
@ -110,7 +110,11 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<!--android:fastScrollAlwaysVisible="true"-->
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/contactsListRefresher"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/contactsList"
|
android:id="@+id/contactsList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -119,6 +123,8 @@
|
||||||
|
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/contactsFetchInProgress"
|
android:id="@+id/contactsFetchInProgress"
|
||||||
style="?android:attr/progressBarStyle"
|
style="?android:attr/progressBarStyle"
|
||||||
|
|
Loading…
Reference in a new issue