Added spinner while downloading image
This commit is contained in:
parent
f9c135a3f1
commit
5e6a900798
3 changed files with 21 additions and 1 deletions
|
@ -26,6 +26,14 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1" />
|
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
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
|
|
|
@ -25,6 +25,13 @@
|
||||||
android:text="@string/download_image"
|
android:text="@string/download_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
|
|
|
@ -412,6 +412,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
bubble.setShowOrDownloadImageButtonListener(new OnClickListener() {
|
bubble.setShowOrDownloadImageButtonListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
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() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -428,13 +431,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public void run() {
|
public void run() {
|
||||||
((ImageView)v.findViewById(R.id.image)).setImageBitmap(bm);
|
((ImageView)v.findViewById(R.id.image)).setImageBitmap(bm);
|
||||||
v.findViewById(R.id.image).setVisibility(View.VISIBLE);
|
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 {
|
} else {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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);
|
LinphoneActivity.instance().displayCustomToast(getString(R.string.download_image_failed), Toast.LENGTH_LONG);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue