baoyongzhang / android-actionsheet Goto Github PK
View Code? Open in Web Editor NEWiOS UIActionSheet for Android
License: MIT License
iOS UIActionSheet for Android
License: MIT License
Application crashed if using support library. Try to use getSupportedFragmentManager instead.
public void dismiss() {
if (mDismissed) {
return;
}
mDismissed = true;
new Handler().post(new Runnable() {
public void run() {
getFragmentManager().popBackStack();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.remove(ActionSheet.this);
ft.commitAllowingStateLoss();
}
});
}
I found on the HUAWEI phone test, NavBar transparent, get to the NavaBarHeight=0(android 5.1), which is not right, it should be used to obtain the following program NavBarHeight:
`
public int getNavBarHeight(Context context) {
int navigationBarHeight = 0;
Resources rs = context.getResources();
int id = rs.getIdentifier("navigation_bar_height", "dimen", "android");
if (id > 0 && checkDeviceHasNavigationBar(context)) {
navigationBarHeight = rs.getDimensionPixelSize(id);
}
return navigationBarHeight;
}
private boolean checkDeviceHasNavigationBar(Context context) {
boolean hasNavigationBar = false;
Resources rs = context.getResources();
int id = rs.getIdentifier("config_showNavigationBar", "bool", "android");
if (id > 0) {
hasNavigationBar = rs.getBoolean(id);
}
try {
Class systemPropertiesClass = Class.forName("android.os.SystemProperties");
Method m = systemPropertiesClass.getMethod("get", String.class);
String navBarOverride = (String) m.invoke(systemPropertiesClass, "qemu.hw.mainkeys");
if ("1".equals(navBarOverride)) {
hasNavigationBar = false;
} else if ("0".equals(navBarOverride)) {
hasNavigationBar = true;
}
} catch (Exception e) {
e.printStackTrace();
}
return hasNavigationBar;
}`
Hi there,
I tried to using this plugin with 2 button named camera and gallery.
But when I invoke it, it only showed one button.
Could be something wrong here. Then could we check that?
Thanks a lot.
Kind regards,
How to make it scroll if the list is long..? please help..
In iOS, when we have too many items in the Action Sheet, more than can be displayed on screen, it automatically starts scrolling.
Is there any chance of scrolling being implemented in the action sheet? Please at least give suggestions on how this could be done, and I'll try to implement it.
弹出ActionSheet之后,如果点击BACK键,AS背后的Activity或者Fragment还会有响应。
While the action bar sheet is open and the user press back the application is crashing.
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1377)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1395)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:637)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:616)
at com.talkweb.cloudcampus.view.ActionSheet.show(ActionSheet.java:65)
at com.talkweb.cloudcampus.view.ActionSheet$Builder.show(ActionSheet.java:482)
at com.talkweb.cloudcampus.ui.common.ImageViewPagerActivity.LongPress(ImageViewPagerActivity.java:128)
at com.talkweb.cloudcampus.ui.common.ImageViewPagerActivity$ImagePagerAdapter$2.onLongClick(ImageViewPagerActivity.java:155)
at com.talkweb.cloudcampus.view.gallery.touchview.TouchImageView$1.onLongPress(TouchImageView.java:146)
at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:690)
at android.view.GestureDetector.access$200(GestureDetector.java:37)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:266)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5372)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
很难复现的情况,不知道是不是使用方法的问题?
All the texts on the buttons are by default all capitalized. I think when setting text on a button, we need to setAllCaps(false) to disable that. Or is there an API from this ActionSheet library that we can use to disable all caps?
Thanks!
Hi,
I want to include this style in my actionbar menu
Instead of, getMenuInflater().inflate(R.menu.main, menu);
I even tried adding this in my style,
@style/ActionSheetStyleiOS7
Thanks in advance
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:27:9-36
is also present at [com.baoyz.actionsheet:library:1.1.0] AndroidManifest.xml:12:9-35 value=(true)
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:25:5-178:19 to override
java.lang.IllegalStateException: Activity has been destroyed
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1399)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:637)
at android.support.v4.app.BackStackRecord.commitAllowingStateLoss(BackStackRecord.java:620)
at com.talkweb.cloudcampus.view.ActionSheet.show(ActionSheet.java:65)
at com.talkweb.cloudcampus.view.ActionSheet$Builder.show(ActionSheet.java:484)
at com.talkweb.cloudcampus.jsbridge.WebActivity.selectImage(WebActivity.java:477)
at com.talkweb.cloudcampus.jsbridge.WebActivity$CustomChromeClient.openFileChooser(WebActivity.java:343)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:859)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4829)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
已将ActionSheet的show方法中讲commit改为commitAllowingStateLoss,不知为何出现这样的报错?
如果使用butterknife 的onClick 注解 setListener还可以设置吗
1.1.6中5.x上action sheet会显示在NavBar顶上,4.x上就会有两倍NavBarHeight的高度了
假设我背后的Fragment上有个EditText,输入了内容并且焦点停留在EditText上;
启动ActionSheet后,软键盘还保留在UI上,这时候用软键盘依然可以输入。
It is giving exception here for api level. i think you should give this method only in api level>=17.
Please check here: manager.isDestroyed()
You can write like this to avoid the problem:
if(Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR2){
}else{
}
I want to set other titles with icons.. how can i do that with your code.?
is this possible to set the position to draw out from the top bar??
Please use bottom sheets instead.
I tried it myselt,but didn't get it worked as expected.To be precisely, the main problem is that the theme is not working.
Hi,
I see that padding parameter applied to all four sides.
Could you instead make it like sidePadding, topPadding, and bottomPadding?
I can do it myself, but it would be better if this was available for others as well.
如何实现多个actionsheet在同一活动不同的选项?
Android的工作室告诉“ onOtherButtonClick ”已被使用。
请帮帮我
While using action sheet and testing on lolipop devices, the action sheet appears above the bottom navigation bar (eg Nexus5) and click event also taking from navigation bar.
How could I use the same action sheet on lolipop devices avoiding overlapping of navigation bar and action sheet?
在Huawei Ascend Mate7手机上,显示的字体特别大,明显不对。
Hello,
I am getting this fatal exception when try to dismiss & open actionsheet several times continuously.
Here's the full stack trace.
Fatal Exception: java.lang.IllegalStateException
Can not perform this action after onSaveInstanceState
raw
android.support.v4.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:1377)
android.support.v4.app.FragmentManagerImpl.popBackStack (FragmentManager.java:495)
com.baoyz.actionsheet.ActionSheet.dismiss (ActionSheet.java:98)
com.baoyz.actionsheet.ActionSheet.onClick (ActionSheet.java:387)
android.view.View.performClick (View.java:5254)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)
Would you please tell me how I can get over with this issue?
Thank you!
You know , in high version of Android, the menu key can't be intercepted through onKeyDown
method as long press will call to show "recent task".
So, do you know how to show the ActionSheet by press down the menu key and hide it when press again?
How to use it with Activity and not fragment?
I cannot use it to Fragment when I set ActionSheet.
It cannot find getSupportFragmentManager().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.