diff --git a/app/src/main/java/com/limelight/grid/AppGridAdapter.java b/app/src/main/java/com/limelight/grid/AppGridAdapter.java index 5863a192..daba5fba 100644 --- a/app/src/main/java/com/limelight/grid/AppGridAdapter.java +++ b/app/src/main/java/com/limelight/grid/AppGridAdapter.java @@ -1,6 +1,7 @@ package com.limelight.grid; import android.content.Context; +import android.graphics.BitmapFactory; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; @@ -76,7 +77,8 @@ public class AppGridAdapter extends GenericGridAdapter { this.loader = new CachedAppAssetLoader(computer, scalingDivisor, new NetworkAssetLoader(context, uniqueId), new MemoryAssetLoader(), - new DiskAssetLoader(context)); + new DiskAssetLoader(context), + BitmapFactory.decodeResource(context.getResources(), R.drawable.no_app_image)); // This will trigger the view to reload with the new layout setLayoutId(getLayoutIdForPreferences(prefs)); diff --git a/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java b/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java index 2c85ab7f..06fa695b 100644 --- a/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java +++ b/app/src/main/java/com/limelight/grid/assets/CachedAppAssetLoader.java @@ -52,15 +52,17 @@ public class CachedAppAssetLoader { private final MemoryAssetLoader memoryLoader; private final DiskAssetLoader diskLoader; private final Bitmap placeholderBitmap; + private final Bitmap noAppImageBitmap; public CachedAppAssetLoader(ComputerDetails computer, double scalingDivider, NetworkAssetLoader networkLoader, MemoryAssetLoader memoryLoader, - DiskAssetLoader diskLoader) { + DiskAssetLoader diskLoader, Bitmap noAppImageBitmap) { this.computer = computer; this.scalingDivider = scalingDivider; this.networkLoader = networkLoader; this.memoryLoader = memoryLoader; this.diskLoader = diskLoader; + this.noAppImageBitmap = noAppImageBitmap; this.placeholderBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); } @@ -188,9 +190,10 @@ public class CachedAppAssetLoader { prgView.setVisibility(View.VISIBLE); } - // Set off another loader task on the network executor + // Set off another loader task on the network executor. This time our AsyncDrawable + // will use the app image placeholder bitmap, rather than an empty bitmap. LoaderTask task = new LoaderTask(imageView, prgView, false); - AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.getResources(), placeholderBitmap, task); + AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.getResources(), noAppImageBitmap, task); imageView.setVisibility(View.VISIBLE); imageView.setImageDrawable(asyncDrawable); task.executeOnExecutor(networkExecutor, tuple); diff --git a/app/src/main/res/drawable-xhdpi/no_app_image.png b/app/src/main/res/drawable-xhdpi/no_app_image.png new file mode 100644 index 00000000..4cbad3e0 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/no_app_image.png differ diff --git a/app/src/main/res/layout/app_grid_item.xml b/app/src/main/res/layout/app_grid_item.xml index 95a2ebca..8a12af40 100644 --- a/app/src/main/res/layout/app_grid_item.xml +++ b/app/src/main/res/layout/app_grid_item.xml @@ -8,14 +8,6 @@ android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content"> - - + + - - + +