Add contact refresh

This commit is contained in:
Erwan Croze 2018-07-13 14:33:06 +02:00
parent e49bc31cc6
commit 493812faba
2 changed files with 26 additions and 5 deletions

View file

@ -125,12 +125,19 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/contactsList"
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/colorE"
android:dividerHeight="1dp"/>
android:layout_height="match_parent">
<ListView
android:id="@+id/contactsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/colorE"
android:dividerHeight="1dp"/>
</android.support.v4.widget.SwipeRefreshLayout>
<ProgressBar
android:id="@+id/contactsFetchInProgress"

View file

@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.app.Dialog;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
@ -60,6 +61,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
private LayoutInflater mInflater;
private ListView contactsList;
private TextView noSipContact, noContact;
private SwipeRefreshLayout swipeRefresh;
private ImageView allContacts, linphoneContacts, newContact, edit, selectAll, deselectAll, delete, cancel;
private boolean onlyDisplayLinphoneContacts, isEditMode, isSearchMode;
private View allContactsSelected, linphoneContactsSelected;
@ -87,6 +89,18 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
noSipContact = (TextView) view.findViewById(R.id.noSipContact);
noContact = (TextView) view.findViewById(R.id.noContact);
swipeRefresh = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout);
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//TODO get contact
if (LinphoneManager.getLc() != null) {
LinphoneManager.getLc().refreshRegisters();
}
swipeRefresh.setRefreshing(false);
}
});
contactsList = (ListView) view.findViewById(R.id.contactsList);
contactsList.setOnItemClickListener(this);