Comments (10)
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.
ok here is the original image (i have this with all the images)
Should I try with .jpeg images ?
from android-bootstrap.
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.
yes i set the images programatically , because i fetch them from a web server then i save them on my sdcard ?
from android-bootstrap.
Can you post the code you're using to set the images?
from android-bootstrap.
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.
so do i have some thing wrong with my code ?
from android-bootstrap.
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.
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.
@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)
- How can I use Databinding for bootstrapText? HOT 1
- How can set data to BootstrapDropDown programmatically? HOT 1
- Font 'fontawesome-webfont-v470.ttf' not properly registered. HOT 2
- how to use custom color? HOT 1
- Update gradle dependencies HOT 1
- Making bootstrap button extend android.widget.button HOT 1
- app stopped when bootstrap dropdown inserted HOT 1
- Using Custom Fonts
- Bootstrap Dropdown doesn't work programmatically
- BootstrapProgressBar crashed when setting maxProgress
- BootstrapProgressBar
- landscape issue in bootstrap progress bar HOT 1
- Cannot show or hide Bootstrap button (visibility change) HOT 4
- radio button problem in a scroll view
- Rounded corners of ProgressBarGroup breaks if maximum
- .
- Cannot set background color
- .
- Compatibility with androidx HOT 1
- icons
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-bootstrap.