Giter Club home page Giter Club logo

Comments (10)

jamie-beardedhen avatar jamie-beardedhen commented on May 21, 2024

I couldn't reproduce this exact case, can you upload the image used to trigger this?

It does look like there is some weirdness trying to display png files via layout attributes - the attribute always seems to return a default value, which isn't the case for jpegs. This might be related to changes on my local branch but if not I'll raise a separate issue.

from android-bootstrap.

hatim-haffane avatar hatim-haffane commented on May 21, 2024

ok here is the original image (i have this with all the images)
1394280210tt_carusell_drawing_920x360

Should I try with .jpeg images ?

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 21, 2024

Adding that image as a jpg/png didn't reproduce the problem for me. Are you doing anything else with the BootstrapCircleThumbnail after it's instantiated e.g. calling setImage()?

from android-bootstrap.

hatim-haffane avatar hatim-haffane commented on May 21, 2024

yes i set the images programatically , because i fetch them from a web server then i save them on my sdcard ?

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 21, 2024

Can you post the code you're using to set the images?

from android-bootstrap.

hatim-haffane avatar hatim-haffane commented on May 21, 2024

first i download the image to a bitmap :

public static Bitmap getBitmapFromURL(String src) {
try {
src = src.replace(" ", "%20");
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}

then i save it to the sdcard as a png file :

public static Boolean writeImage(Bitmap btmp, String name) {

    // File sdCardDirectory = Environment.getExternalStorageDirectory();
    String path = Environment.getExternalStorageDirectory().toString();

    new File(path + "/taxidiali/media").mkdirs();
    File filename = new File(path + "/taxidiali/media/" + name);

    boolean success = false;

    // Encode the file as a PNG image.
    FileOutputStream outStream;
    try {

        outStream = new FileOutputStream(filename);
        btmp.compress(Bitmap.CompressFormat.PNG, 100, outStream);
        /* 100 to keep full quality of the image */

        outStream.flush();
        outStream.close();
        success = true;
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return success;

}

then when i need it i read it from the sdcard :

public static Bitmap readImage(String url, String name) throws IOException {
File sdCard = Environment.getExternalStorageDirectory();

    File directory = new File(sdCard.getAbsolutePath() + url);

    File file = new File(directory, name); // or any other format supported

    FileInputStream streamIn = new FileInputStream(file);

    Bitmap bitmap = BitmapFactory.decodeStream(streamIn); // This gets the
                                                            // image

    streamIn.close();
    return bitmap;
}

then i set it to the BootstrapCircleThumbnail :

image_profil = (BootstrapCircleThumbnail) rowView.findViewById(R.id.img_thumb);
Bitmap bMap = null;
try {
bMap = Utilities.readImage("/taxidiali/media/" , infosTaxi.getPhoto());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

image_profil.setImage(bMap);

that all

from android-bootstrap.

hatim-haffane avatar hatim-haffane commented on May 21, 2024

so do i have some thing wrong with my code ?

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 21, 2024

Looks like this is a bug in the library rather than a fault with your code. I'm not too familiar with the internal workings of the image processing so this may take a while to debug.

from android-bootstrap.

theDazzler avatar theDazzler commented on May 21, 2024

I think the bug was introduced in this commit 38e3530 as well as this commit e226043 or one similar to it where the BoostrapCircleThumbnail class was refactored. Before it was refactored, you had to call this inside of setImage()

placeholder.setPadding(0, 0, 0, 0);
this.dimensionsLabel.setVisibility(View.GONE);
this.image.setVisibility(View.VISIBLE);

As you can see in your bug, the grey background is still there even though you specified an image to be there. It needs to be removed. I tried fixing it and doing a pull request but it's been a hassle trying to get it working with the old gradle version being used.

I think the fix is just to add this in setImage()

this.dimensionsLabel.setVisibility(View.GONE);
this.image.setVisibility(View.VISIBLE);

and add this private variable

TextView dimensionsLabel;

and remove the line that declares this variable.

My fork has the code in it before the refactoring and it works fine after adding the one line that hides the dimensionsLabel.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 21, 2024

@theDazzler that seems to have fixed it, I'll push an update shortly once I've resolved a few more tickets.

from android-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.