Comments (8)
Hi,
I also experienced the same issue on sony Xperia S (Android 4.0.4).
The menu buttons open nicely but gets pushed towards left the next moment.
Any help would be appreciated.
Thanks,
Sunny
from android-satellite-menu.
Hi Sunny,
I found a really UGLY way to fix this bug on Xperia. Indeed, I didn't find a generic way to fix this, just a special case for this device... BTW, if you really want a fix, it works.
In SatelliteMenu.java :
Modify addItems :
public void addItems(List<SatelliteMenuItem> items) {
// special case for Sony Xperia S (ugly, I'm sorry...)
if(android.os.Build.MODEL.equals("LT26i")){
theWorstHandlingOfExceptionOfAllTheTimes(items);
return;
}
....
}
And create a new method :
/* Special handling of a strange bug in displaying of items on Sony Xperia S.
* Caution child, this is done nearly the worst way it could.
* Don't try this at home !
*/
private void theWorstHandlingOfExceptionOfAllTheTimes(List<SatelliteMenuItem> items) {
RelativeLayout relativeLayout = new RelativeLayout(getContext());
// Appreciate the hard coding dimensions
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
satelliteDistance + 100, satelliteDistance + 100);
layoutParams.gravity = Gravity.BOTTOM;
relativeLayout.setLayoutParams(layoutParams);
menuItems.addAll(items);
this.removeView(imgMain);
float[] degrees = getDegrees(menuItems.size());
int index = 0;
for (SatelliteMenuItem menuItem : menuItems) {
int finalX = SatelliteAnimationCreator.getTranslateX(degrees[index], satelliteDistance);
int finalY = SatelliteAnimationCreator.getTranslateY(degrees[index], satelliteDistance);
CustomView itemView = (CustomView) LayoutInflater.from(getContext()).inflate(
R.layout.sat_item_cr, this, false);
CustomView cloneView = (CustomView) LayoutInflater.from(getContext()).inflate(
R.layout.sat_item_cr, this, false);
itemView.setTag(menuItem.getId());
cloneView.setVisibility(View.GONE);
itemView.setVisibility(View.GONE);
cloneView.setOnClickListener(internalItemClickListener);
cloneView.setTag(Integer.valueOf(menuItem.getId()));
RelativeLayout.LayoutParams layoutParamsClone = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// And again...
int finalYInverse = Math.abs(SatelliteAnimationCreator.getTranslateY(degrees[index],
satelliteDistance)) - 20;
int finalXInverse = Math.abs(SatelliteAnimationCreator.getTranslateX(degrees[index],
satelliteDistance));
layoutParamsClone.setMargins(finalXInverse, satelliteDistance - finalYInverse, 0, 0);
cloneView.setLayoutParams(layoutParamsClone);
if (menuItem.getImgResourceId() > 0) {
itemView.setImageResource(menuItem.getImgResourceId());
cloneView.setImageResource(menuItem.getImgResourceId());
} else if (menuItem.getImgDrawable() != null) {
itemView.setImageDrawable(menuItem.getImgDrawable());
cloneView.setImageDrawable(menuItem.getImgDrawable());
}
Animation itemOut = SatelliteAnimationCreator.createItemOutAnimation(getContext(),
index, expandDuration, finalX, finalY);
Animation itemIn = SatelliteAnimationCreator.createItemInAnimation(getContext(), index,
expandDuration, finalX, finalY);
Animation itemClick = SatelliteAnimationCreator.createItemClickAnimation(getContext());
menuItem.setView(itemView);
menuItem.setCloneView(cloneView);
menuItem.setInAnimation(itemIn);
menuItem.setOutAnimation(itemOut);
menuItem.setClickAnimation(itemClick);
menuItem.setFinalX(finalX);
menuItem.setFinalY(finalY);
itemIn.setAnimationListener(new SatelliteAnimationListener(itemView, true,
viewToItemMap));
itemOut.setAnimationListener(new SatelliteAnimationListener(itemView, false,
viewToItemMap));
itemClick.setAnimationListener(new SatelliteItemClickAnimationListener(this, menuItem
.getId()));
this.addView(itemView);
relativeLayout.addView(cloneView);
viewToItemMap.put(itemView, menuItem);
viewToItemMap.put(cloneView, menuItem);
index++;
}
this.addView(relativeLayout);
this.addView(imgMain);
}
Hope it will help you...
Gabriel
from android-satellite-menu.
Hi Gabriel,
Could please explain what kind of object is: CustomView in the below line of code:
CustomView itemView = (CustomView) LayoutInflater.from(getContext()).inflate(
R.layout.sat_item_cr, this, false);
As, the android is unable to resolve it.
Thanks,
Sunny
from android-satellite-menu.
Sorry, I forgot that I use my own view instead of the original ImageView.
Just use the same image view than in addItems method :
ImageView itemView = (ImageView) LayoutInflater.from(getContext())
.inflate(R.layout.sat_item_cr, this, false);
ImageView cloneView = (ImageView) LayoutInflater.from(getContext())
.inflate(R.layout.sat_item_cr, this, false);
Cheers,
Gabriel
from android-satellite-menu.
Hi,
I had a similar bug on an Xperia, running 4.0.4.
Changing from a FrameLayout to a RelativeLayout seemed to fix the problem for me
from android-satellite-menu.
Hi dwally,
I tried changing from FrameLayout to a RelativeLayout,but its not working.
Can you please share your code.
Thanks.
from android-satellite-menu.
Hi
I faced the same problem on Xperia Neo L. This fixed it thank you. Do you know if it's like this only on xperia devices or there are other devices that show similar behavior?
EDIT:
I was wrong. I tested it on Xperia M and it works fine. It was just my own device so I added MT25i to the black list.
from android-satellite-menu.
my device oppo find5t,china phone
from android-satellite-menu.
Related Issues (20)
- rotating diffrent item .
- Add title for each menu item HOT 3
- How to take menu on right side of screen HOT 6
- fix this issue
- xml attributes do not work
- 360度のメニューが表示されるように改良しました
- sat_main traslation on rotate right
- redraw satellite items
- Satelitte menu in actionbar?
- Can we add touch and drag gesture on menu rather than touch?? HOT 1
- BadParcelableException HOT 4
- Center menu HOT 2
- always on Top
- SetOnClickListener on only the button? HOT 2
- Setting up in gradle project missing
- Adding programmatically
- Adding library to project HOT 1
- the itemclickEvent should be after the itemIn animation
- Can I close it in the other area?
- How To Compile In Android Studio
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-satellite-menu.