mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Use image alpha to make images transparent while loading
This commit is contained in:
parent
a8bf2cd1cf
commit
265b3f9963
@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -166,8 +165,8 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean populateImageView(final ImageView imgView, final AppView.AppObject obj) {
|
public boolean populateImageView(final ImageView imgView, final AppView.AppObject obj) {
|
||||||
// Hide the image view while we're loading the image from disk cache
|
// Clear existing contents of the image view
|
||||||
imgView.setVisibility(View.INVISIBLE);
|
imgView.setImageAlpha(0);
|
||||||
|
|
||||||
// Check the on-disk cache
|
// Check the on-disk cache
|
||||||
new ImageCacheRequest(imgView, obj.app.getAppId()).execute();
|
new ImageCacheRequest(imgView, obj.app.getAppId()).execute();
|
||||||
@ -229,7 +228,7 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
// Disk cache was read successfully
|
// Disk cache was read successfully
|
||||||
LimeLog.info("Image disk cache hit for ("+computer.uuid+", "+appId+")");
|
LimeLog.info("Image disk cache hit for ("+computer.uuid+", "+appId+")");
|
||||||
view.setImageBitmap(result);
|
view.setImageBitmap(result);
|
||||||
view.setVisibility(View.VISIBLE);
|
view.setImageAlpha(255);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LimeLog.info("Image disk cache miss for ("+computer.uuid+", "+appId+")");
|
LimeLog.info("Image disk cache miss for ("+computer.uuid+", "+appId+")");
|
||||||
@ -238,7 +237,7 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
|
|
||||||
// Load the placeholder image
|
// Load the placeholder image
|
||||||
view.setImageResource(defaultImageRes);
|
view.setImageResource(defaultImageRes);
|
||||||
view.setVisibility(View.VISIBLE);
|
view.setImageAlpha(255);
|
||||||
|
|
||||||
// Set SSL contexts correctly to allow us to authenticate
|
// Set SSL contexts correctly to allow us to authenticate
|
||||||
Ion.getDefault(context).getHttpClient().getSSLSocketMiddleware().setTrustManagers(trustAllCerts);
|
Ion.getDefault(context).getHttpClient().getSSLSocketMiddleware().setTrustManagers(trustAllCerts);
|
||||||
@ -261,7 +260,7 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
// Make the view visible now
|
// Make the view visible now
|
||||||
view.setImageBitmap(result);
|
view.setImageBitmap(result);
|
||||||
view.setVisibility(View.VISIBLE);
|
view.setImageAlpha(255);
|
||||||
|
|
||||||
// Populate the disk cache if we got an image back.
|
// Populate the disk cache if we got an image back.
|
||||||
// We do it in a new thread because it can be very expensive, especially
|
// We do it in a new thread because it can be very expensive, especially
|
||||||
|
Loading…
x
Reference in New Issue
Block a user