Commit 73bc5380 authored by Grigory Fedorov's avatar Grigory Fedorov

ContactVcardViewerFragment: progress bar added.

parent 3a4aac38
...@@ -52,6 +52,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha ...@@ -52,6 +52,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
private LinearLayout contactInfoItems; private LinearLayout contactInfoItems;
private VCard vCard; private VCard vCard;
private boolean vCardError; private boolean vCardError;
private View progressBar;
public static ContactVcardViewerFragment newInstance(String account, String user) { public static ContactVcardViewerFragment newInstance(String account, String user) {
ContactVcardViewerFragment fragment = new ContactVcardViewerFragment(); ContactVcardViewerFragment fragment = new ContactVcardViewerFragment();
...@@ -108,6 +109,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha ...@@ -108,6 +109,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
xmppItems = (LinearLayout) view.findViewById(R.id.xmpp_items); xmppItems = (LinearLayout) view.findViewById(R.id.xmpp_items);
contactInfoItems = (LinearLayout) view.findViewById(R.id.contact_info_items); contactInfoItems = (LinearLayout) view.findViewById(R.id.contact_info_items);
progressBar = view.findViewById(R.id.contact_info_progress_bar);
return view; return view;
} }
...@@ -118,13 +120,16 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha ...@@ -118,13 +120,16 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
Application.getInstance().addUIListener(OnVCardListener.class, this); Application.getInstance().addUIListener(OnVCardListener.class, this);
Application.getInstance().addUIListener(OnContactChangedListener.class, this); Application.getInstance().addUIListener(OnContactChangedListener.class, this);
Application.getInstance().addUIListener(OnAccountChangedListener.class, this); Application.getInstance().addUIListener(OnAccountChangedListener.class, this);
if (vCard == null && !vCardError) {
VCardManager.getInstance().request(account, user);
}
updateContact(account, user); updateContact(account, user);
if (vCard == null && !vCardError) {
progressBar.setVisibility(View.VISIBLE);
VCardManager.getInstance().request(account, user);
} else {
updateVCard(vCard); updateVCard(vCard);
} }
}
@Override @Override
public void onPause() { public void onPause() {
...@@ -151,6 +156,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha ...@@ -151,6 +156,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
this.vCard = vCard; this.vCard = vCard;
this.vCardError = false; this.vCardError = false;
updateVCard(vCard); updateVCard(vCard);
progressBar.setVisibility(View.GONE);
} }
@Override @Override
...@@ -160,6 +166,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha ...@@ -160,6 +166,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
} }
this.vCard = null; this.vCard = null;
this.vCardError = true; this.vCardError = true;
progressBar.setVisibility(View.GONE);
Application.getInstance().onError(R.string.XMPP_EXCEPTION); Application.getInstance().onError(R.string.XMPP_EXCEPTION);
} }
......
...@@ -14,6 +14,13 @@ ...@@ -14,6 +14,13 @@
android:orientation="vertical" android:orientation="vertical"
/> />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_info_progress_bar"
android:visibility="gone"
android:layout_gravity="center_horizontal" />
<LinearLayout <LinearLayout
android:id="@+id/contact_info_items" android:id="@+id/contact_info_items"
android:layout_width="match_parent" android:layout_width="match_parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment