Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. public static Dialog showPopupOneButton(String popupType, String messsage, Context context, View.OnClickListener listener) {
  2. final Dialog common_one_button_popup = new Dialog(context); // Bir dialog olustur
  3. common_one_button_popup.setCancelable(false);
  4. common_one_button_popup.requestWindowFeature(Window.FEATURE_NO_TITLE); // Dialog basligini
  5. common_one_button_popup.setContentView(R.layout.popup_common_one_button);
  6.  
  7. // viewlari getir
  8. ImageView imageViewCommonPopupType = (ImageView) common_one_button_popup.findViewById(R.id.imageViewCommonPopupType);
  9. LoginFontTextView textViewCommonPopupType = (LoginFontTextView) common_one_button_popup.findViewById(R.id.textViewCommonPopupType);
  10. LoginFontTextView textViewCommonPopupInfo = (LoginFontTextView) common_one_button_popup.findViewById(R.id.textViewCommonPopupInfo);
  11. Button buttonCommonPopup = (Button) common_one_button_popup.findViewById(R.id.buttonCommonPopup);
  12.  
  13. Typeface typeFaceBold = Typeface.createFromAsset(context.getAssets(), "fonts/Turkcell_Satura_Bold.ttf");
  14. buttonCommonPopup.setTypeface(typeFaceBold);
  15.  
  16. // ture gore basliklari sekillendir
  17. if (popupTypeError.equalsIgnoreCase(popupType)) {
  18. imageViewCommonPopupType.setImageResource(R.drawable.commonpopuperror);
  19. textViewCommonPopupType.setText(context.getString(R.string.commonPopupHeaderError));
  20. } else if (popupTypeCaution.equalsIgnoreCase(popupType)) {
  21. imageViewCommonPopupType.setImageResource(R.drawable.commonpopupcaution);
  22. textViewCommonPopupType.setText(context.getString(R.string.commonPopupHeaderCaution));
  23. } else if (popupTypePositive.equalsIgnoreCase(popupType)) {
  24. imageViewCommonPopupType.setImageResource(R.drawable.commonpopuppositive);
  25. textViewCommonPopupType.setText(context.getString(R.string.commonPopupHeaderPositive));
  26. } else if (popupTypeInformation.equalsIgnoreCase(popupType)) {
  27. imageViewCommonPopupType.setImageResource(R.drawable.commonpopupinfo);
  28. textViewCommonPopupType.setText(context.getString(R.string.commonPopupHeaderInfo));
  29. } else if (popupTypeApproval.equalsIgnoreCase(popupType)) {
  30. imageViewCommonPopupType.setImageResource(R.drawable.commonpopupinfo);
  31. textViewCommonPopupType.setText(context.getString(R.string.commonPopupHeaderApproval));
  32. }
  33.  
  34. // mesaji set et
  35. textViewCommonPopupInfo.setText(messsage);
  36.  
  37. // popun in listenerlari
  38. if (listener == null)
  39. buttonCommonPopup.setOnClickListener(new View.OnClickListener() {
  40.  
  41. @Override
  42. public void onClick(View v) {
  43. common_one_button_popup.dismiss();
  44. }
  45. });
  46. else
  47. buttonCommonPopup.setOnClickListener(listener);
  48.  
  49. // Popupi goster
  50. common_one_button_popup.show();
  51.  
  52. return common_one_button_popup;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement