Added spinner while downloading image

This commit is contained in:
Sylvain Berfini 2014-07-22 14:30:45 +02:00
parent f9c135a3f1
commit 5e6a900798
3 changed files with 21 additions and 1 deletions

View file

@ -26,6 +26,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ProgressBar
android:id="@+id/spinner"
android:visibility="gone"
android:indeterminate="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/time"

View file

@ -25,6 +25,13 @@
android:text="@string/download_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/spinner"
android:visibility="gone"
android:indeterminate="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/time"

View file

@ -412,6 +412,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
bubble.setShowOrDownloadImageButtonListener(new OnClickListener() {
@Override
public void onClick(View view) {
v.findViewById(R.id.spinner).setVisibility(View.VISIBLE);
v.findViewById(R.id.download).setVisibility(View.GONE);
new Thread(new Runnable() {
@Override
public void run() {
@ -428,13 +431,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public void run() {
((ImageView)v.findViewById(R.id.image)).setImageBitmap(bm);
v.findViewById(R.id.image).setVisibility(View.VISIBLE);
v.findViewById(R.id.download).setVisibility(View.GONE);
v.findViewById(R.id.spinner).setVisibility(View.GONE);
}
});
} else {
mHandler.post(new Runnable() {
@Override
public void run() {
v.findViewById(R.id.spinner).setVisibility(View.GONE);
v.findViewById(R.id.download).setVisibility(View.VISIBLE);
LinphoneActivity.instance().displayCustomToast(getString(R.string.download_image_failed), Toast.LENGTH_LONG);
}
});