Search in sources :

Example 11 with DialogPlus

use of com.orhanobut.dialogplus.DialogPlus in project dialogplus by orhanobut.

the class MainActivity method showNoFooterDialog.

private void showNoFooterDialog(Holder holder, int gravity, BaseAdapter adapter, OnClickListener clickListener, OnItemClickListener itemClickListener, OnDismissListener dismissListener, OnCancelListener cancelListener, boolean expanded) {
    final DialogPlus dialog = DialogPlus.newDialog(this).setContentHolder(holder).setHeader(R.layout.header).setCancelable(true).setGravity(gravity).setAdapter(adapter).setOnClickListener(clickListener).setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
            Log.d("DialogPlus", "onItemClick() called with: " + "item = [" + item + "], position = [" + position + "]");
        }
    }).setOnDismissListener(dismissListener).setOnCancelListener(cancelListener).setExpanded(expanded).create();
    dialog.show();
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) OnItemClickListener(com.orhanobut.dialogplus.OnItemClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 12 with DialogPlus

use of com.orhanobut.dialogplus.DialogPlus in project dialogplus by orhanobut.

the class DialogPlusTest method testGetHolderView.

@Test
public void testGetHolderView() {
    LinearLayout layout = new LinearLayout(context);
    DialogPlus dialog = DialogPlus.newDialog(context).setContentHolder(new ViewHolder(layout)).create();
    assertThat(dialog.getHolderView()).isEqualTo(layout);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) ViewHolder(com.orhanobut.dialogplus.ViewHolder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 13 with DialogPlus

use of com.orhanobut.dialogplus.DialogPlus in project dialogplus by orhanobut.

the class DialogPlusTest method testGetHeaderView.

@Test
public void testGetHeaderView() {
    LinearLayout layout = new LinearLayout(context);
    LinearLayout header = new LinearLayout(context);
    DialogPlus dialog = DialogPlus.newDialog(context).setContentHolder(new ViewHolder(layout)).setHeader(header).create();
    assertThat(dialog.getHeaderView()).isEqualTo(header);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) ViewHolder(com.orhanobut.dialogplus.ViewHolder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 14 with DialogPlus

use of com.orhanobut.dialogplus.DialogPlus in project dialogplus by orhanobut.

the class DialogPlusTest method testGetFooterView.

@Test
public void testGetFooterView() {
    LinearLayout layout = new LinearLayout(context);
    LinearLayout footer = new LinearLayout(context);
    DialogPlus dialog = DialogPlus.newDialog(context).setContentHolder(new ViewHolder(layout)).setFooter(footer).create();
    assertThat(dialog.getFooterView()).isEqualTo(footer);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) ViewHolder(com.orhanobut.dialogplus.ViewHolder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 15 with DialogPlus

use of com.orhanobut.dialogplus.DialogPlus in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testSetOnDismissListener.

@Test
public void testSetOnDismissListener() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getOnDismissListener()).isNull();
    OnDismissListener listener = new OnDismissListener() {

        @Override
        public void onDismiss(DialogPlus dialog) {
        }
    };
    builder.setOnDismissListener(listener);
    assertThat(builder.getOnDismissListener()).isNotNull();
    assertThat(builder.getOnDismissListener()).isEqualTo(listener);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) OnDismissListener(com.orhanobut.dialogplus.OnDismissListener) Test(org.junit.Test)

Aggregations

DialogPlus (com.orhanobut.dialogplus.DialogPlus)18 Test (org.junit.Test)12 View (android.view.View)8 TextView (android.widget.TextView)7 OnItemClickListener (com.orhanobut.dialogplus.OnItemClickListener)6 DialogPlusBuilder (com.orhanobut.dialogplus.DialogPlusBuilder)5 ViewHolder (com.orhanobut.dialogplus.ViewHolder)5 LinearLayout (android.widget.LinearLayout)4 OnCancelListener (com.orhanobut.dialogplus.OnCancelListener)3 OnDismissListener (com.orhanobut.dialogplus.OnDismissListener)3 OnBackPressListener (com.orhanobut.dialogplus.OnBackPressListener)2 OnClickListener (com.orhanobut.dialogplus.OnClickListener)2 ActionBar (android.support.v7.app.ActionBar)1 Toolbar (android.support.v7.widget.Toolbar)1 ArrayAdapter (android.widget.ArrayAdapter)1 GridHolder (com.orhanobut.dialogplus.GridHolder)1 Holder (com.orhanobut.dialogplus.Holder)1 ListHolder (com.orhanobut.dialogplus.ListHolder)1