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