1+ package com.contextu.al.fancyannouncement
2+
3+ import android.app.Activity
4+ import android.content.DialogInterface
5+ import android.view.Window
6+ import androidx.appcompat.app.AlertDialog
7+ import com.contextu.al.R
8+
9+ class FancyAnnouncementGuideBlocks (private val activity : Activity ) {
10+
11+ fun show (title : String , content : String , negativeText : String , negativeButtonListener : DialogInterface .OnClickListener ,
12+ positiveText : String , positiveButtonListener : DialogInterface .OnClickListener , imageUrl : String ){
13+ // val view = activity.layoutInflater.inflate(R.layout.fancy_annoucenment, null, true)
14+ // val viewGroup = (activity.findViewById(android.R.id.content) as ViewGroup).getChildAt(0) as ViewGroup
15+ val alertDialog = AlertDialog .Builder (activity)
16+ .setTitle(title)
17+ .setMessage(content)
18+ .setNegativeButton(negativeText, negativeButtonListener)
19+ .setPositiveButton(positiveText, positiveButtonListener)
20+ .create()
21+ alertDialog.requestWindowFeature(Window .FEATURE_NO_TITLE )
22+ alertDialog.setContentView(R .layout.fancy_announcement)
23+ alertDialog.show()
24+ // val fancyAnnouncementImage = alertDialog.findViewById<ImageView>(R.id.announcementImage)
25+ // fancyAnnouncementImage?.let {
26+ // Glide.with(activity.baseContext).load(imageUrl).into(fancyAnnouncementImage)
27+ // }
28+ // val fancyAnnouncementTitle = alertDialog.findViewById<TextView>(R.id.fancy_announcement_title)
29+ // fancyAnnouncementTitle?.text = title
30+ // val fancyAnnouncementContent = alertDialog.findViewById<TextView>(R.id.fancy_announcement_message)
31+ // fancyAnnouncementContent?.text = content
32+ // val imageView = view.findViewById<ImageView>(R.id.fancy_announcement_imageview)
33+ // viewGroup.addView(imageView)
34+ // Glide.with(activity.baseContext).load(imageUrl).into(imageView)
35+
36+ }
37+ }
0 commit comments