Commit 53509e93a8d83dd8b005be5a2dd13197a99efdd9

Authored by 孙向锦
1 parent ba547d80

更新下载页面

C5/app/src/main/java/com/sunvote/xpadapp/fragments/DownloadFragment.java
... ... @@ -8,6 +8,7 @@ import android.view.LayoutInflater;
8 8 import android.view.View;
9 9 import android.view.View.OnClickListener;
10 10 import android.view.ViewGroup;
  11 +import android.widget.ImageView;
11 12 import android.widget.TextView;
12 13 import android.widget.Toast;
13 14  
... ... @@ -30,6 +31,7 @@ public class DownloadFragment extends BaseFragment implements FileReciverInterfa
30 31 private int keypadId ;
31 32 private boolean isConnectWifi;
32 33 private TextView tv;
  34 + private ImageView download_img;
33 35  
34 36 private final int msgConnectError = 1;
35 37 private final int msgOnDownload = 2;
... ... @@ -72,6 +74,7 @@ public class DownloadFragment extends BaseFragment implements FileReciverInterfa
72 74 }
73 75 });
74 76 tv = (TextView) view.findViewById(R.id.download_title);
  77 + download_img = view.findViewById(R.id.download_img);
75 78 downloadRetryCount = 0;
76 79 tv.setOnClickListener(new OnClickListener() {
77 80  
... ... @@ -124,6 +127,7 @@ public class DownloadFragment extends BaseFragment implements FileReciverInterfa
124 127 if(isUiActive) {
125 128 int percent = msg.arg1;
126 129 tv.setText(getString(R.string.downloading) + percent + "%");
  130 + download_img.setImageResource(R.drawable.downloading);
127 131 if(percent == 100){
128 132 tv.setText(getString(R.string.download_over_unzip));
129 133 }
... ... @@ -133,6 +137,7 @@ public class DownloadFragment extends BaseFragment implements FileReciverInterfa
133 137 try {
134 138 LogUtil.d(TAG, "on msgDownloadOver");
135 139 if(isUiActive) {
  140 + download_img.setImageResource(R.drawable.download_complete);
136 141 tv.setText(getString(R.string.download_over));
137 142 }
138 143 isFinishDownload = true;
... ...
C5/app/src/main/res/layout/fragment_download.xml
... ... @@ -4,9 +4,19 @@
4 4 android:layout_width="match_parent"
5 5 android:layout_height="match_parent" >
6 6  
  7 + <View
  8 + android:id="@+id/middle"
  9 + android:layout_width="match_parent"
  10 + android:layout_height="0dp"
  11 + android:layout_centerVertical="true"/>
  12 +
7 13 <ImageView
8   - android:layout_width="wrap_content"
9   - android:layout_height="wrap_content" />
  14 + android:id="@+id/download_img"
  15 + android:layout_width="200dp"
  16 + android:layout_height="200dp"
  17 + android:layout_centerHorizontal="true"
  18 + android:layout_above="@id/middle"
  19 + android:src="@drawable/downloading"/>
10 20  
11 21 <TextView
12 22 android:id="@+id/download_title"
... ... @@ -18,6 +28,8 @@
18 28 android:layout_height="wrap_content"
19 29 android:layout_marginLeft="@dimen/button_width"
20 30 android:layout_marginRight="@dimen/button_width"
21   - android:layout_centerInParent="true" />
  31 + android:layout_centerHorizontal="true"
  32 + android:layout_below="@id/middle"
  33 + android:layout_marginTop="40dp"/>
22 34  
23 35 </RelativeLayout>
... ...