Comments (3)
Hello, @csava . I have a simple solution to handle configuration changes. And I have pushed it to the dev branch.
1 For AndroidResideMenu, I added two overload methods. They provide a same parameter named withAnimations
, you can open/close menu without animations by passing it false
.
public void openMenu(int direction, boolean withAnimations);
public void closeMenu(boolean withAnimations);
2 For activity, I suggest to use onSaveInstanceState()
to save the current opening state and direction of menu. Then, it will pass saved instance state to onCreate()
after configurations changed.
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (resideMenu != null) {
outState.putBoolean(MENU_STATE, resideMenu.isOpened());
outState.putInt(MENU_DIRECTION, resideMenu.getCurrentDirection());
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
....
// Restore the menu state by savedInstanceState.
if ( savedInstanceState != null && savedInstanceState.getBoolean(MENU_STATE) == true ) {
resideMenu.openMenu(savedInstanceState.getInt(MENU_DIRECTION));
}
}
If it works, please comment on here and I will merge code into master. Thanks.
from androidresidemenu.
Hi ,
Thanks for your answer.
Your answer should work when the developer does not require manually handling of the configuration changes.
Unfortunately, my issue is that I need to manually handle the configuration changes by overriding
“onConfigurationChanged” and by putting in the manifest “android:configChanges="keyboard|keyboardHidden|orientation”.
I don't see this issue as a bug but would be a nice enhancement to have it. In many cases android force you to handle the configuration changes manually.
For this case I think residemenu needs an interface like "detachOnCfgChange()"
to be used like
@OverRide
public void onConfigurationChanged(Configuration newConfig)
{
ResideMenu.detachOnCfgChange()
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main);
// Reinitialize the residemenu
setUpMenu();
}
On this call residemenu can do the clean up or others because the main view will be destroyed.
from androidresidemenu.
OK, thanks your idea!
I will find someway to implement it.
from androidresidemenu.
Related Issues (20)
- I have issue with merge dex
- Not Compatible with hide and showing Navigation bar HOT 4
- Activity Usage HOT 1
- Image Url
- Bottom White Bar in the larger screen size HOT 5
- Nested Menu problem HOT 1
- How to get click event of opened page HOT 1
- Low performance
- Remove menu item
- Button in bottom right
- can change menu item layout? HOT 1
- can I show the home page in stack How can i do that?
- Space at the bottom of devices HOT 7
- Android X
- Scroll view Issue HOT 1
- Add custom side menu. no requiremen of right menu
- click on the custom menu in side menu
- Download the library and replace ResideMenu class with given below code.
- residemenu
- Menu
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 androidresidemenu.