/*
* Copyright (c) 2014. Marshal Chen.
*/
package com.marshalchen.common.demoofui.sampleModules;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.marshalchen.common.demoofui.R;
import com.marshalchen.common.uimodule.niftymodaldialogeffects.Effectstype;
import com.marshalchen.common.uimodule.niftymodaldialogeffects.NiftyDialogBuilder;
public class NiftyDialogActivity extends Activity {
private Effectstype effect;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nifty_dialog_activity);
}
public void dialogShow(View v) {
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(this);
switch (v.getId()) {
case R.id.fadein:
effect = Effectstype.Fadein;
break;
case R.id.slideright:
effect = Effectstype.Slideright;
break;
case R.id.slideleft:
effect = Effectstype.Slideleft;
break;
case R.id.slidetop:
effect = Effectstype.Slidetop;
break;
case R.id.slideBottom:
effect = Effectstype.SlideBottom;
break;
case R.id.newspager:
effect = Effectstype.Newspager;
break;
case R.id.fall:
effect = Effectstype.Fall;
break;
case R.id.sidefall:
effect = Effectstype.Sidefill;
break;
case R.id.fliph:
effect = Effectstype.Fliph;
break;
case R.id.flipv:
effect = Effectstype.Flipv;
break;
case R.id.rotatebottom:
effect = Effectstype.RotateBottom;
break;
case R.id.rotateleft:
effect = Effectstype.RotateLeft;
break;
case R.id.slit:
effect = Effectstype.Slit;
break;
case R.id.shake:
effect = Effectstype.Shake;
break;
}
dialogBuilder
.withTitle("Modal Dialog")
.withTitleColor("#FFFFFF")
.withDividerColor("#11000000")
.withMessage("This is a modal Dialog.")
.withMessageColor("#FFFFFF")
.withIcon(getResources().getDrawable(R.drawable.test))
.withEffect(effect)
.withButton1Text("OK")
.withButton2Text("Cancel")
// .setCustomView(viewresId,context)
.setButton1Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "i'm btn1", Toast.LENGTH_SHORT).show();
}
})
.setButton2Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "i'm btn2", Toast.LENGTH_SHORT).show();
}
})
.show();
}
}