Advertisement
gonzalob

Untitled

Nov 10th, 2021
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.47 KB | None | 0 0
  1. package com.emer.beneficiary.ui.dialog;
  2.  
  3. import android.os.*;
  4. import android.view.*;
  5. import android.widget.*;
  6.  
  7. import androidx.annotation.*;
  8. import androidx.fragment.app.*;
  9.  
  10. import com.emer.beneficiary.*;
  11.  
  12. public class UserDataDialogFragment  extends DialogFragment {
  13.  
  14.     private TextView textViewTitle;
  15.     private TextView textViewSubTitle;
  16.     private ImageView imageViewIcon;
  17.  
  18.     public UserDataDialogFragment() {
  19.         // Empty constructor is required for DialogFragment
  20.         // Make sure not to add arguments to the constructor
  21.         // Use `newInstance` instead as shown below
  22.     }
  23.  
  24.     public static UserDataDialogFragment newInstance(int type) {
  25.         UserDataDialogFragment frag = new UserDataDialogFragment();
  26.         Bundle args = new Bundle();
  27.         args.putInt("type", type);
  28.         frag.setArguments(args);
  29.         return frag;
  30.     }
  31.  
  32.     @Override
  33.     public void onCreate(@Nullable Bundle savedInstanceState) {
  34.         super.onCreate(savedInstanceState);
  35.         setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme_Dialog_Custom);
  36.  
  37.     }
  38.  
  39.     @Override
  40.     public View onCreateView(LayoutInflater inflater, ViewGroup container,
  41.                              Bundle savedInstanceState) {
  42.         return inflater.inflate(R.layout.popup_data_ok, container);
  43.     }
  44.  
  45.     @Override
  46.     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  47.         super.onViewCreated(view, savedInstanceState);
  48.         // Get field from view
  49.         textViewTitle = (TextView) view.findViewById(R.id.textViewTitle);
  50.         textViewSubTitle = (TextView) view.findViewById(R.id.textViewSubTitle);
  51.         imageViewIcon = (ImageView) view.findViewById(R.id.imageViewIcon);
  52.         int type = getArguments().getInt("type", 0);
  53.  
  54.         switch (type)
  55.         {
  56.             case 0:
  57.                     textViewTitle.setText("Excelente");
  58.                     textViewSubTitle.setText("Tus datos fueron aprobados con éxito.");
  59.                     break;
  60.             case 1:
  61.                     textViewTitle.setText("En proceso");
  62.                     textViewSubTitle.setText("Tus datos se encuentran en proceso de validación.");
  63.                     break;
  64.             case 2:
  65.                     textViewTitle.setText("Ocurrió un error");
  66.                     textViewSubTitle.setText("TPara modificar los campos seleccionados, deben transcurrir 7 días desde la última modificación.");
  67.                     break;
  68.         }
  69.     }
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement