xiongxiaohe 8 rokov pred
rodič
commit
75fd82201a

+ 13 - 12
app/src/main/java/com/sheep/jiuyan/samllsheep/adapter/DownListAdapter.java

@@ -90,8 +90,8 @@ public class DownListAdapter extends BaseAdapter {
 
         private ImageView ImageView;
         private TextView  tv_game_name;
-        private TextView  tv_state;
-        private TextView  tv_remove;
+        private ImageView  iv_state;
+        private ImageView  iv_remove;
         private ProgressBar pb_download;
         private TextView   tv_prorgess;
 
@@ -99,9 +99,9 @@ public class DownListAdapter extends BaseAdapter {
             super(view, downloadInfo);
             ImageView=(ImageView) view.findViewById(R.id.img_icon);
             tv_game_name=(TextView) view.findViewById(R.id.tv_game_name);
-            tv_state=(TextView) view.findViewById(R.id.tv_state);
+            iv_state=(ImageView) view.findViewById(R.id.iv_state);
             pb_download=(ProgressBar) view.findViewById(R.id.pb_download);
-            tv_remove=(TextView)view.findViewById(R.id.tv_remove);
+            iv_remove=(ImageView)view.findViewById(R.id.iv_remove);
             tv_prorgess=(TextView) view.findViewById(R.id.tv_prorgess);
             refresh();
             Glide.with(mContext)
@@ -109,8 +109,8 @@ public class DownListAdapter extends BaseAdapter {
                     .placeholder(R.drawable.icon)
                     .dontAnimate()
                     .into(ImageView);
-            tv_state.setOnClickListener(this);
-            tv_remove.setOnClickListener(this);
+            iv_state.setOnClickListener(this);
+            iv_remove.setOnClickListener(this);
 
         }
 
@@ -157,18 +157,19 @@ public class DownListAdapter extends BaseAdapter {
             switch (state) {
                 case WAITING:
                 case STARTED:
-                    tv_state.setText("暂停");
+                    iv_state.setImageResource(R.drawable.icon_stop);
                     break;
                 case ERROR:
                 case STOPPED:
-                    tv_state.setText("开始");
+                    iv_state.setImageResource(R.drawable.icon_begin);
                     break;
                 case FINISHED:
                     PackageUtil.installApk(mContext, getDownloadInfo().getFileSavePath());
-                    tv_state.setText("完成");
+                    iv_state.setVisibility(View.GONE);
+                    tv_prorgess.setText("完成");
                     break;
                 default:
-                    tv_state.setText("开始");
+                    iv_state.setImageResource(R.drawable.icon_begin);
                     break;
             }
         }
@@ -178,7 +179,7 @@ public class DownListAdapter extends BaseAdapter {
         @Override
         public void onClick(View view) {
              switch (view.getId()){
-                 case  R.id.tv_state:
+                 case  R.id.iv_state:
                      DownloadState state = downloadInfo.getState();
                      switch (state) {
                          case WAITING:
@@ -208,7 +209,7 @@ public class DownListAdapter extends BaseAdapter {
                              break;
                      }
                      break;
-                 case  R.id.tv_remove:
+                 case  R.id.iv_remove:
                      try {
                          downloadManager.removeDownload(downloadInfo);
                           notifyDataSetChanged();

+ 5 - 3
app/src/main/java/com/sheep/jiuyan/samllsheep/page/MainActivity.java

@@ -14,6 +14,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
 import android.util.Log;
 import android.view.View;
 import android.widget.Button;
+import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -213,9 +214,8 @@ public class MainActivity extends BaseActivity {
         ((TextView) findViewById(R.id.txt_baseactivity_title)).setText("我的奖金");
 
 
-        Button btn= (Button) findViewById(R.id.btn_baseactivity_right);
-        btn.setBackgroundResource(R.drawable.icon_app);
-
+        ImageButton btn= (ImageButton) findViewById(R.id.ibtn_baseactivity_right);
+        btn.setImageResource(R.drawable.icon_download);
         btn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -223,6 +223,8 @@ public class MainActivity extends BaseActivity {
                 startActivity(i);
             }
         });
+        btn.setVisibility(View.VISIBLE);
+
 
         mRappTabLayout = (RappTabLayout) findViewById(R.id.tab_main_activity);
         mViewPager = (ViewPager) findViewById(R.id.viewpager_main_activity);

BIN
app/src/main/res/drawable-hdpi/icon_begin.png


BIN
app/src/main/res/drawable-hdpi/icon_delet.png


BIN
app/src/main/res/drawable-hdpi/icon_download.png


BIN
app/src/main/res/drawable-hdpi/icon_stop.png


BIN
app/src/main/res/drawable-xhdpi/icon_begin.png


BIN
app/src/main/res/drawable-xhdpi/icon_delet.png


BIN
app/src/main/res/drawable-xhdpi/icon_download.png


BIN
app/src/main/res/drawable-xhdpi/icon_stop.png


BIN
app/src/main/res/drawable-xxhdpi/icon_begin.png


BIN
app/src/main/res/drawable-xxhdpi/icon_delet.png


BIN
app/src/main/res/drawable-xxhdpi/icon_download.png


BIN
app/src/main/res/drawable-xxhdpi/icon_stop.png


+ 18 - 14
app/src/main/res/layout/down_item.xml

@@ -19,15 +19,19 @@
             android:layout_marginLeft="10dp"
             android:src="@drawable/icon_sheep"
             />
-
+      <LinearLayout
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:orientation="vertical"
+          android:layout_centerVertical="true"
+          android:layout_marginLeft="10dp"
+          android:layout_toRightOf="@id/img_icon"
+          >
 
         <TextView
             android:id="@+id/tv_game_name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="10dp"
-            android:layout_toRightOf="@id/img_icon"
             android:text="2019-12-26"
             android:textColor="@color/black_dark"/>
 
@@ -36,13 +40,12 @@
             android:textColor="@color/theme"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_alignParentRight="true"
             android:textSize="16sp"
             android:text="30%"
             android:layout_marginTop="10dp"
             android:layout_marginRight="10dp"
             />
-
+      </LinearLayout>
 
        <LinearLayout
            android:layout_width="wrap_content"
@@ -54,20 +57,21 @@
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            >
-        <TextView
-            android:id="@+id/tv_state"
+        <ImageView
+            android:id="@+id/iv_state"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="5dp"
-            android:text="开始"
-            android:textColor="@color/theme"/>
-           <TextView
-               android:id="@+id/tv_remove"
+            android:src="@drawable/icon_stop"
+            />
+           <ImageView
+               android:id="@+id/iv_remove"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="5dp"
-               android:text="删除"
-               android:textColor="@color/theme"/>
+               android:layout_marginLeft="10dp"
+               android:src="@drawable/icon_delet"
+            />
        </LinearLayout>
     </RelativeLayout>