diff --git a/app/src/main/java/com/gh/common/view/DownloadDialog.java b/app/src/main/java/com/gh/common/view/DownloadDialog.java index eb9b35672c..9a1f75b98f 100644 --- a/app/src/main/java/com/gh/common/view/DownloadDialog.java +++ b/app/src/main/java/com/gh/common/view/DownloadDialog.java @@ -16,7 +16,6 @@ import android.support.v4.view.ViewPager.OnPageChangeListener; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; -import android.util.Log; import android.util.SparseArray; import android.view.Gravity; import android.view.KeyEvent; @@ -111,7 +110,7 @@ public class DownloadDialog { if (position - 1 < adapterMap.size()) { adapterMap.get(position - 1).notifyItemChanged(location % (row * column)); - if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1){ + if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){ collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column)); } } @@ -213,12 +212,12 @@ public class DownloadDialog { TextView textView = (TextView) contentView.findViewById(R.id.dialog_title); textView.setText(gameName); - int count = game.getApk().size(); + int count = gameApk.size(); int vpHeight = 0; if (count <= 3){ - vpHeight = 72; + vpHeight = 80; }else if (count <= 6){ - vpHeight = 136; + vpHeight = 140; }else { vpHeight = 200; } @@ -510,13 +509,13 @@ public class DownloadDialog { entryMap.remove(url); int position = (int) Math.ceil((location + 1) / (double) (row * column)); adapterMap.get(position - 1).notifyItemChanged(location % (row * column)); - if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1){ + if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){ collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column)); } } else if ("卸载".equals(busFour.getType())) { int position = (int) Math.ceil((location + 1) / (double) (row * column)); adapterMap.get(position - 1).notifyItemChanged(location % (row * column)); - if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1){ + if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){ collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column)); } } @@ -531,7 +530,7 @@ public class DownloadDialog { entryMap.remove(url); int position = (int) Math.ceil((location + 1) / (double) (row * column)); adapterMap.get(position - 1).notifyItemChanged(location % (row * column)); - if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1){ + if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){ collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column)); } } @@ -1157,15 +1156,17 @@ public class DownloadDialog { } private void showCollectionLayout(GameCollectionEntity gameCollectionEntity) { + int count = gameCollectionEntity.getSaveApkEntity().size(); int vpHeight = 0; if (count <= 3){ - vpHeight = 72; + vpHeight = 80; }else if (count <= 6){ - vpHeight = 136; + vpHeight = 140; }else { vpHeight = 200; } + ViewGroup.LayoutParams layoutParams = collectionViewPager.getLayoutParams(); layoutParams.height = DisplayUtils.dip2px(context, vpHeight); collectionViewPager.setLayoutParams(layoutParams); @@ -1177,7 +1178,6 @@ public class DownloadDialog { collectionLinearLayout.removeAllViews(); int size = (int) Math.ceil(gameCollectionEntity.getSaveApkEntity().size() / (double) (row * column)); - Log.e("============",":::"+size); if (size > 1) { for (int i = 0; i < size; i++) { ImageView imageView = new ImageView(context); @@ -1195,6 +1195,7 @@ public class DownloadDialog { collectionLinearLayout.addView(imageView); } } + int currentItem = 0; if (viewPager != null) { currentItem = viewPager.getCurrentItem(); @@ -1211,7 +1212,6 @@ public class DownloadDialog { @Override public void onPageSelected(int position) { - Log.e("+++++++++",collectionLinearLayout.getChildCount()+""); for (int i = 0, size = collectionLinearLayout.getChildCount(); i < size; i++) { if (i == position % size) { ((ImageView) collectionLinearLayout.getChildAt(i)) @@ -1237,7 +1237,6 @@ public class DownloadDialog { this.saveApkEntity = saveApkEntity; } - @Override public int getCount() { return (int) Math.ceil(saveApkEntity.size() / (double) (row * column));