Advertisement
Guest User

Untitled

a guest
Oct 13th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.52 KB | None | 0 0
  1. /**
  2.  * This screen just serves as confirmation that the report was successful
  3.  *
  4.  * Created by marc on 2014/09/05.
  5.  */
  6.  
  7. object ReportAbuseConfirmedFragment {
  8.   /** where we store the report's reference number */
  9.   final val EXTRA_REFERENCE: String = "report_reference"
  10.   def apply(reference: String)(implicit context: Context) = {
  11.     val args = new Bundle()
  12.     args.putString(EXTRA_REFERENCE, reference)
  13.     args.putString(BaseFragment.EXTRA_FRAGMENT_TITLE, context.getString(R.string.report_abuse))
  14.     val fragment = new ReportAbuseConfirmedFragment()
  15.     fragment.setArguments(args)
  16.     fragment
  17.   }
  18. }
  19.  
  20. class ReportAbuseConfirmedFragment extends MBaseFragment {
  21.   var reportReference: String = _
  22.  
  23.   override def onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle): View = {
  24.     implicit val view = inflater.inflate(R.layout.profile_abuse_report_confirmed_fragment, container, false)
  25.     // try get the report reference that this fragment SHOULD ALWAYS be initialized with if this value is not here it was not initialized correctly
  26.     reportReference = getArguments.getString(ReportAbuseConfirmedFragment.EXTRA_REFERENCE)
  27.     // set the text to include the reference number
  28.     MTextView(R.id.txtReportReference).text = getString(R.string.user_reported_reference, reportReference)
  29.     // set the onClick listener of the OK button
  30.     MButton(R.id.btn_ok).onClick = v => {
  31.       v.setEnabled(false)
  32.       mActivity.getSupportFragmentManager.popBackStack()
  33.     }
  34.     view
  35.   }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement