Search in sources :

Example 1 with ViewHolder

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

the class DialogPlusTest method testFindViewById.

@Test
public void testFindViewById() {
    LinearLayout layout = new LinearLayout(context);
    TextView textView = new TextView(context);
    textView.setId(android.R.id.text1);
    layout.addView(textView);
    DialogPlus dialog = DialogPlus.newDialog(context).setContentHolder(new ViewHolder(layout)).create();
    assertThat(dialog.findViewById(android.R.id.text1)).isNotNull();
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) ViewHolder(com.orhanobut.dialogplus.ViewHolder) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 2 with ViewHolder

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

the class DialogPlusBuilderTest method testSetContentHolder.

@Test
public void testSetContentHolder() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //Test ListHolder
    ListHolder listHolder = new ListHolder();
    builder.setContentHolder(listHolder);
    assertThat(builder.getHolder()).isEqualTo(listHolder);
    //test GridHolder
    GridHolder gridHolder = new GridHolder(3);
    builder.setContentHolder(gridHolder);
    assertThat(builder.getHolder()).isEqualTo(gridHolder);
    //test ViewHolder
    ViewHolder viewHolder = new ViewHolder(new LinearLayout(context));
    builder.setContentHolder(viewHolder);
    assertThat(builder.getHolder()).isEqualTo(viewHolder);
    //should accept null
    builder.setContentHolder(null);
}
Also used : ViewHolder(com.orhanobut.dialogplus.ViewHolder) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) GridHolder(com.orhanobut.dialogplus.GridHolder) ListHolder(com.orhanobut.dialogplus.ListHolder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 3 with ViewHolder

use of com.orhanobut.dialogplus.ViewHolder 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 4 with ViewHolder

use of com.orhanobut.dialogplus.ViewHolder 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 5 with ViewHolder

use of com.orhanobut.dialogplus.ViewHolder 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)

Aggregations

ViewHolder (com.orhanobut.dialogplus.ViewHolder)10 LinearLayout (android.widget.LinearLayout)9 Test (org.junit.Test)8 DialogPlus (com.orhanobut.dialogplus.DialogPlus)5 View (android.view.View)4 LayoutInflater (android.view.LayoutInflater)2 TextView (android.widget.TextView)2 GridHolder (com.orhanobut.dialogplus.GridHolder)2 ListHolder (com.orhanobut.dialogplus.ListHolder)2 DialogPlusBuilder (com.orhanobut.dialogplus.DialogPlusBuilder)1 Holder (com.orhanobut.dialogplus.Holder)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