Search in sources :

Example 6 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testSetOnCancelListener.

@Test
public void testSetOnCancelListener() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getOnCancelListener()).isNull();
    OnCancelListener listener = new OnCancelListener() {

        @Override
        public void onCancel(DialogPlus dialog) {
        }
    };
    builder.setOnCancelListener(listener);
    assertThat(builder.getOnCancelListener()).isNotNull();
    assertThat(builder.getOnCancelListener()).isEqualTo(listener);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) OnCancelListener(com.orhanobut.dialogplus.OnCancelListener) Test(org.junit.Test)

Example 7 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testContentLayoutParams_whenExpandedFalseAndNotSet.

@Test
public void testContentLayoutParams_whenExpandedFalseAndNotSet() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getContentParams()).isInstanceOf(FrameLayout.LayoutParams.class);
    //when not expanded
    FrameLayout.LayoutParams params = builder.getContentParams();
    assertThat(builder.isExpanded()).isFalse();
    assertThat(params.width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
    assertThat(params.height).isEqualTo(ViewGroup.LayoutParams.WRAP_CONTENT);
    assertThat(params.gravity).isEqualTo(Gravity.BOTTOM);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) FrameLayout(android.widget.FrameLayout) Test(org.junit.Test)

Example 8 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testFooter.

@Test
public void testFooter() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    builder.setFooter(android.R.layout.simple_list_item_1);
    assertThat(builder.getFooterView()).isNotNull();
    LinearLayout footerView = new LinearLayout(context);
    builder.setFooter(footerView);
    assertThat(builder.getFooterView()).isEqualTo(footerView);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 9 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testSetOnItemClickListener.

@Test
public void testSetOnItemClickListener() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getOnItemClickListener()).isNull();
    OnItemClickListener listener = new OnItemClickListener() {

        @Override
        public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
        }
    };
    builder.setOnItemClickListener(listener);
    assertThat(builder.getOnItemClickListener()).isNotNull();
    assertThat(builder.getOnItemClickListener()).isEqualTo(listener);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) OnItemClickListener(com.orhanobut.dialogplus.OnItemClickListener) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) View(android.view.View) Test(org.junit.Test)

Example 10 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testSetCancelable.

@Test
public void testSetCancelable() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //default should be true
    assertThat(builder.isCancelable()).isTrue();
    builder.setCancelable(false);
    assertThat(builder.isCancelable()).isFalse();
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) Test(org.junit.Test)

Aggregations

DialogPlusBuilder (com.orhanobut.dialogplus.DialogPlusBuilder)28 Test (org.junit.Test)28 FrameLayout (android.widget.FrameLayout)7 DialogPlus (com.orhanobut.dialogplus.DialogPlus)5 LinearLayout (android.widget.LinearLayout)3 View (android.view.View)2 ArrayAdapter (android.widget.ArrayAdapter)1 GridHolder (com.orhanobut.dialogplus.GridHolder)1 ListHolder (com.orhanobut.dialogplus.ListHolder)1 OnBackPressListener (com.orhanobut.dialogplus.OnBackPressListener)1 OnCancelListener (com.orhanobut.dialogplus.OnCancelListener)1 OnClickListener (com.orhanobut.dialogplus.OnClickListener)1 OnDismissListener (com.orhanobut.dialogplus.OnDismissListener)1 OnItemClickListener (com.orhanobut.dialogplus.OnItemClickListener)1 ViewHolder (com.orhanobut.dialogplus.ViewHolder)1