orhanobut / dialogplus Goto Github PK
View Code? Open in Web Editor NEWAdvanced dialog solution for android
License: Apache License 2.0
Advanced dialog solution for android
License: Apache License 2.0
How can i show this dialog from top below toolbar
just like this:
AlertDialog.Builder d = new AlertDialog.Builder(yourcontext);
d.setMultiChoiceItems(elements, null , new OnMultiChoiceClickListener() {
@OverRide
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked){
String str = elements[which];
Toast.makeText(youractivity.this,
"you have selected"+str,
Toast.LENGTH_LONG).show();
}
}
});
I want to start a view animation after the dialogplus measure. But I can not get the event. I need to calculate the position and size before the animation start.
It would be nice to have an option to consume Back key event and don't pass it to rest of activity.
Hello,
Is there a way to use Fragments within the dialog?
I've been trying to add a view with a FrameLayout element and calling FragmentManager methods to fetch and change views but it says something about IllegalStateException, view has already a parent or something like that.
I'm trying to make a dialog with tabs...
I went for TabHost but I got different problems with deprecated classes.
I went for ViewPager and PagerTabStrip but it's not the UX I was required to implement.
So I decided to make all by hand with Fragments but I cannot communicate with a FrameLayout for content within your dialog. The FragmentManager mess up with the hierarchy I think...
I'd appreciate any clues about this issue.
view passet to setHeader() method in DialogPlus.newDialog(context) builder object
actually appears as footer. And view passet to setFooter() appears as header.
version 1.9
bug in DialogPlus class. line line 181
private View createView(LayoutInflater inflater, View footerView, View headerView, BaseAdapter adapter)
params View footerView, View headerView are misplaced
It would be better if this work like DialogFragment.
We should add an option to inject listview,gridview for the holder
It will be cool to have L animation, when the dialog is at the bottom, scrolling from bottom to top would stretch the dialog to whole screen
Hi @orhanobut thank you for you lib but i have two questions;
How to implement clicklistener on a view in footer and or header?[fix to be define after the creation of the dialog]
Do you plan to add recyclerAdapter support for recycler view?
best regards,
Hi,
First of all tnx very much for such clean and developer friendly library :)
As you can be seen in attachment i could not center on horizontal axis. Does library support this functionality or did i miss something?
Here is my code :
final DialogPlus dialog = new DialogPlus.Builder(this)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
//
}
})
.setGravity(DialogPlus.Gravity.CENTER)
.setContentHolder(isparkDetailView)
.setCancelable(true)
.create();
dialog.show();
King Regards
DialogPlus setAdapter only way,
How can I do when the pop-up dialog like ListView setSelection () display
When I try to set ViewHolder to an inflated view, I receive this error and nothing is displayed :
My code :
View view = mInflater.inflate(R.layout.my_popup, null, false);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int height = size.y;
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, (int) (height * .75));
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
view.setLayoutParams(params);
WebView webView = (WebView) view.findViewById(R.id.webView);
WebSettings settings = webView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
webView.setScrollContainer(false);
webView.loadDataWithBaseURL(null, sample_dictionary_html, "text/html", "utf-8", null);
dialog_plus = new DialogPlus.Builder(this)
.setContentHolder(new ViewHolder(view))
.create();
dialog_plus.show();
MY ERROR
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at android.widget.AdapterView.setOnClickListener(AdapterView.java:926)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.setClickListener(DialogPlus.java:413)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:402)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:399)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:399)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:399)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:399)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.createView(DialogPlus.java:361)
04-04 12:06:41.839 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.initContentView(DialogPlus.java:286)
04-04 12:06:41.844 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.createDialog(DialogPlus.java:276)
04-04 12:06:41.844 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.(DialogPlus.java:168)
04-04 12:06:41.844 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus.(DialogPlus.java:18)
04-04 12:06:41.844 4282-4282/com.daftar.Abrar.Interface W/System.err﹕ at com.orhanobut.dialogplus.DialogPlus$Builder.create(DialogPlus.java:666)
I have a function, which on success shows a dialog. However, if there is an error it will show a different dialog. If they press "OK" on the error dialog the function is recursively called and now ends in success. However the other dialog will not show, it's almost as if the old dialog isnt being dismissed in time.
Hi, I want to add a whellview to dialogplus, it extend from spinner. but throw a exception.
07-25 22:13:30.493: E/AndroidRuntime(13740): java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.jyxtec.wheel.TosAdapterView.setOnClickListener(TosAdapterView.java:803)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.setClickListener(DialogPlus.java:315)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:300)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:297)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:297)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:297)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.assignClickListenerRecursively(DialogPlus.java:297)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.createView(DialogPlus.java:259)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.initContentView(DialogPlus.java:227)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlus.(DialogPlus.java:111)
07-25 22:13:30.493: E/AndroidRuntime(13740): at com.orhanobut.dialogplus.DialogPlusBuilder.create(DialogPlusBuilder.java:265)
This setup is invalid.
builder.setOnCancelListener(new OnCancelListener() {
@OverRide
public void onCancel(DialogPlus dialogPlus) {
dialogPlus.show();
}
});
builder.setOnBackPressListener(new OnBackPressListener() {
@Override
public void onBackPressed(DialogPlus dialogPlus) {
dialogPlus.show();
}
});
I have two dialog method. If the user press the button in first dialog (from Gravity.TOP) i want show the next dialog (Gravity.Bottom). But the second dialog not present on view. In debug i see the dialog.create() and show() run. The two dialog born from MainActivity.
I need some clear someWhere before show the second dialog?
First dialog:
public void shareButtonClickced()
{
ShareNoConnectionAdapter shAdapter = new ShareNoConnectionAdapter(this);
DialogPlus dialog = new DialogPlus.Builder(this)
.setAdapter(shAdapter)
.setGravity(DialogPlus.Gravity.TOP)
.setHeader(R.layout.dialog_share_header)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, final int position) {
dialog.dismiss();
showLoginDialog();
}
})
.create();
dialog.show();
}
Second dialog:
public void showLoginDialog()
{
ExitViewAdapter lgAdapter = new ExitViewAdapter(this);
DialogPlus dialog = new DialogPlus.Builder(this)
.setAdapter(lgAdapter)
.setGravity(DialogPlus.Gravity.BOTTOM)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, final int position) {
dialog.dismiss();
//my rest of code
}
})
.create();
dialog.show();
}
Thank you in advance for your help
I was messing around with DialogPlus, and I came accoss this "issue". I'm not able to show a child dialog from parent dialog. Here's the code:
final ArrayAdapter<String> childAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{"Nothing to do", "do nothing"});
final DialogPlus child = DialogPlus.newDialog(Settings.this)
.setInAnimation(R.anim.dialogin).setBackgroundColorResourceId(R.color.bg)
.setOutAnimation(R.anim.dialogout)
.setAdapter(childAdapter)
.create();
final ArrayAdapter<String> parentAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{"Dismiss", "Show another dialog"});
final DialogPlus parent = DialogPlus.newDialog(Settings.this)
.setInAnimation(R.anim.dialogin).setBackgroundColorResourceId(R.color.bg)
.setOutAnimation(R.anim.dialogout)
.setAdapter(parentAdapter)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
switch (position) {
case 0:
dialog.dismiss();
break;
case 1:
child.show();
dialog.dismiss();
break;
}
Log.v("Issue", parentAdapter.getItem(position));
}
})
.create();
parent.show();
Logcat report of clicks:
08-16 02:56:16.702 28131-28131/net.darkion.test V/Issue﹕ Dismiss
08-16 02:56:20.980 28131-28131/net.darkion.test V/Issue﹕ Show another dialog
However, the second dialog is shown when child.show(); is added an OnDismissListener()
Hi
I want to report a conflict error:
AGPBI: {"kind":"ERROR","text":"Attribute \"corner_radius\" has already been defined","sourcePath":"{Path to app}\\app\\build\\intermediates\\exploded-aar\\com.orhanobut\\dialogplus\\1.10\\res\\values\\values.xml","position":{"startLine":1},"original":""}
The conflict is reported for the library: https://github.com/kanytu/ImageWindow
I am using an custom adaptor and returning an arraylist of a custom class, when I am using
adaptor.getItem(position); the position returned is 1 above the item selected. It looks like it is not taking into account that Arraylist is 0 indexed?
SetOnClickItem doesnt work for grid Holder
actually , it select the whole line read the first item in the line only
thnx
I am trying below code in my activity but is not calling the click listener.
DialogPlus dialogPlus = new DialogPlus.Builder(MainActivity.this)
.setAdapter(new SimpleAdapter(MainActivity.this,false))
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(DialogPlus dialog, View view) {
dialog.dismiss();
}
})
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
dialog.dismiss();
}
})
.create();
dialogPlus.show();
Am I doing anything wrong?
setPadding method should be introduced
The demo will be cashed when the dialog dismissed,and the logcat print the error:java.lang.NullPointerException
at android.view.View.drawAnimation(View.java:13968).......
at android.os.Looper.loop(Looper.java:136)...
I don't know why, I can't location the error. The API level is 21 and 4.4
Hello,
Is it possible to integrate blur to background?
Like : https://github.com/500px/500px-android-blur
Default background is transparent black. But i needed blur effect.
King Regards
PS : i do not know how to mark as feature request or question :)
Doing DialogPlusBuilder#setGravity(Gravity.CENTER | Gravity.CENTER_HORIZONTAL) causes a crash because it can't work out the animation to play in #getOutAnimation(). I think it just requires a bit mask check rather than using equals.
Can add some interface to make custom background animation?
Hey guys,
When using the viewholder, how do I get a hold of the view so that I can make changes to the textview and imageview properties inside of that view?
As Ordinary Dialog does, DialogPlus seems like to have the listener that notifies the user when DialogPlus dismisses. mind if I push a pull request for this issue and review for my code? thanks.
Hello,
Even i used :
setBackgroundColorResourceId(R.color.transparent_color)
there is still a transparent background i could change it like this :
((FrameLayout) findViewById(R.id.content_container).getParent()).setBackgroundColor(getResources().getColor(R.color.transparent_color))
FYI
I've checked DialogPlus class and it doesn't seem to exist? or did I miss something
Hello,
onClick attributes are not working in dialog hich i define in layout xml. Here is an example :
<ImageButton
android:id="@+id/genderMaleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/button_male"
android:background="@color/transparent_color"
android:onClick="selectMale"/>
selectMale method is defined in caller activity and it works if i embed layout xml contents into main layout xml.
King Regards
PS : i found that parent must be defined while inflating : http://stackoverflow.com/questions/5444516/inflated-layouts-buttons-onclick-listener-not-working i do not know if this is the solution but wanted to share if in any case it has any help
DialogPlus has an issue on older Android versions (I tested on an Incredible S running 4.0.4).
Gives the following exception:
java.lang.NullPointerException
at android.view.GLES20RecordingCanvas.drawPatch(GLES20RecordingCanvas.java:97)...
Can be solved by changing line 256 in the DialogPlus class from:
decorView.removeView(rootView);
to:
decorView.post(new Runnable() {
@OverRide
public void run() {
decorView.removeView(rootView);
}
});
Grid and List holder should be affected via setMargin
java.lang.NumberFormatException
at org.apache.harmony.luni.util.FloatingPointParser.parseFltImpl(Native Method)
at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:321)
at java.lang.Float.parseFloat(Float.java:323)
at android.content.res.TypedArray.getFloat(TypedArray.java:304)
at android.view.animation.ScaleAnimation.<init>(ScaleAnimation.java:54)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:110)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:106)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:83)
at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:64)
at com.orhanobut.dialogplus.DialogPlus.onAttached(DialogPlus.java:506)
at com.orhanobut.dialogplus.DialogPlus.show(DialogPlus.java:202)
trying:
DialogPlus dialog = new DialogPlus.Builder(getActivity())
.setAdapter(new AdapterAssist(getActivity(), adapter.event.status))
.setGravity(DialogPlus.Gravity.CENTER)
.setContentHolder(new GridHolder(3))
.setOnItemClickListener( ...).create();
dialog.show();
Bug on:
Galaxy S2 (GT-I9100)
Android 2.3.3 - 2.3.7
I would like the header and footer to always be visible. Right now, in a big list, you have to scroll to the bottom to find the footer (containing cancel, accept, etc buttons), which feels wrong.
Also, because of this implementation (I suppose), they do not show up if I use the GridHolder.
Do I have to use a custom ViewHolder for the behavior I want?
hi Which android api supported by this library
dialog.getWindow().setDimAmount(0);
is there any way to do like this?
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.