Closed marianpavel closed 8 years ago
I change the color back to default, it seems it's a problem with the library and the latest version, Note: I have updated from 1.0.1 Edit: tested again on 1.0.1 and it's working, on 1.0.2 and 1.0.3 it's not working.
I checked it and didn't find any problem. Could you show me your code?
I ll show you the code in one hour when I get to work. On Feb 23, 2016 03:36, "yankai-victor" notifications@github.com wrote:
I checked it and didn't find any problem. Could you show me your code?
— Reply to this email directly or view it on GitHub https://github.com/yankai-victor/Loading/issues/7#issuecomment-187466557 .
I am creating a custom object in my application:
`public class ProgressLayout extends RelativeLayout {
private TextView text;
private RotateLoading pb;
public ProgressLayout(Context context) {
super(context);
SharedPreferences pref = context.getSharedPreferences("MyPref", Context.MODE_PRIVATE);
pb = new RotateLoading(context);
// pb.setLoadingColor(R.color.material_drawer_primary);
text = new TextView(context);
Converter conv = Converter.getInstance(context);
setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
LayoutParams layoutParams = new LayoutParams(conv.toPixels(70), conv.toPixels(70));
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
addView(pb, layoutParams);
if(pref.getBoolean("runWizard", true))
text.setText(R.string.searchingMessage);
else
text.setText(R.string.searchingMessage2);
LayoutParams textParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, conv.toPixels(200));
textParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
textParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
textParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
textParams.setMargins(0, conv.toPixels(5), 0, 0);
addView(text, textParams);
pb.start();
}
public void setMessage(int message) {
text.setText(message);
}
public void start() {
pb.start();
}
}`
and creating the object in my activity and adding it to the layout.
I found the problem. If RotateLoading is created by xml, it will work fine. But if it's created by code, it will freezes. I forgot to add the default value of speedOfDegree. It is freezes, because the speedOfDegree is zero. The code
speedOfDegree = DEFAULT_SPEED_OF_DEGREE;
should be added in line 73, after
shadowPosition = dpToPx(getContext(), DEFAULT_SHADOW_POSITION);
I could only update the code by my own computer after work. So it will be about 4 or 5 hours later. Sorry for that.
No problem :+1: update it when you can
It' has been update.
It's working, great job.
Hi, I have setted the color programmatically and it freezes the rotate loading, can you checkt this issue please ?