خانه اندروید

800 ساعت آموزش اختصاصی

بیش از 30 هزار دانشجو

آموزش های پروژه محور

مطالب پیشنهادی حتما مشاهده کنید :

کتابخانه اندروید کاتلین Elegant Dialog Kotlin

کتابخانه اندروید کاتلین Elegant Dialog Kotlin

کتابخانه اندروید کاتلین Elegant Dialog Kotlin

کتابخانه اندروید کاتلین دیالوگ dialog

Elegant Dialog

با سلام و خسته نباشید خدمت کاربران گرامی سایت خانه اندروید در خدمت شما دوستان هستیم با معرفی کتابخانه کاتلین بنام Elegant Dialog که خیلی زیبا و کاربردی هست و می توانید به سادگی توی پروژه هاتون از این کتابخانه قدرتمند جهت نمایش سریع یک پست و یا اطلاعاتی شامل فالو و لایک و دیسلایک حتی از این دیالوگ استفاده کنید.دقت بفرمایین کاملا قابل شخصی سازی هست و می توانید دیالوگ خودتان را معرفی کنید به سادگی و فراخوانی کنید.

طبق روال برای افزودن کتابخانه لازم هست حتما از vpn استفاده کنید :

در بخش build gradel موارد زیرا اضافه و روی سینک کلیک کنید تا کتابخانه اضافه شود.

 allprojects {
   repositories {
 ...
  maven { url 'https://jitpack.io' }
      }
 }
     
dependencies {
  ...
  implementation 'com.github.muigukenneth:ElegantDialog:1.1.1'
}

 

  نکته در این مورد این کتابخانه

قابلیت هایی که این کتابخانه برای مدیریت هر چه بهتر توسط شما قرار داده شامل موارد زیر هست !
سفارشی سازی پس‌زمینه بالا
سفارشی سازی پس‌زمینه پایین
چیدمان سفارشی
شمایل‌های سفارشی (دکمه‌ها و سمت)
رنگ‌های رنگی (شمایل و متن)
متن customizations (دکمه‌ها، عنوان و محتوا)
فونت‌های سفارشی (عنوان و محتوا)

سورس کد با کامنیت و توضیحات فارسی کلی در مورد تمامی بخش ها :

   val dialog = ElegantDialog(context)
                .setTitleIcon(titleIcon)//در این بخش می توانید ایکن انتخاب کنید برای عنوان
                .setTitleIconBackgroundColor(backgroundIconColor) //ا drawable می توانید تصویر را انتخاب کنید.
                .setBackgroundTopColor(backgroundTopColor)// تغییر رنگ دکمه بالایی
                .setBackgroundBottomColor(backgroundBottomColor) // تغییر رنگ دکمه
                .setCustomView(R.layout.custom_image_layout)//در این بخش می توانید لایه مورد نظر معرفی کنید که نیازمند ساخت این لایه هستین
                .setCornerRadius(50f) //در این بخش می توانید میزان گرد کردن را مشخص کنید.
                .setCanceledOnTouchOutside(false) // از بین بردن دیالوگ
                .setTitleHidden(false) // هاید کردن عنوان
                .setElegantActionClickListener(object :
                    ElegantActionListeners {
                    override fun onPositiveListener(dialog: ElegantDialog) {
                      
                        dialog.dismiss()
                    }

                    override fun onNegativeListener(dialog: ElegantDialog) {
                        dialog.dismiss()
                    }

                    override fun onGotItListener(dialog: ElegantDialog) {

                        dialog.dismiss()
                    }

                    override fun onCancelListener(dialog: DialogInterface) {
                        dialog.dismiss()
                    }
                })
                .show()  // حتما باید این بخش را برای نمایش دیالوگ قرار بدین
                
                 // access your customView
             val contentView: View? = dialog.getCustomView()
              
            // عنوان و دکمه را می توانید در این بخش مدیریت کنید.
            if (dialog.getTitleIconView() != null) {
                // در این بخش می توانید برای لود تصویر از گلاید یا پیکاسو هم استفاده کنید.
                val imageUrl = R.drawable.face
                Glide.with(this).load(imageUrl)
                    .transition(ImageUtils.requestAvatarTransitionOptions())
                    .apply(ImageUtils.requestAvatarOptions("app"))
                    .into(dialog.getTitleIconView()!!)
                    
                dialog.getTitleTextView()!!.text = titleText //نمایش یا ست کردن عنوان
                dialog.getTitleTextView()!!.setTextColor(titleTextColor) //رنگ متن عنوان را تنظیم کنید
                
                dialog.getContentTextView()!!.text = contentText // در این بخش می توانید محتوا را ست کنید
                dialog.getContentTextView()!!.setTextColor(contentTextColor) //می توانید مسج را تغییر رنگ بدین
                
                dialog.getPositiveButtonIconView()!!.setImageDrawable(positiveIcon) //نماد دکمه مثبت را قابل تنظیم کنید
                dialog.getPositiveButtonIconView()!!.setColorFilter(positiveIconColor) //نماد دکمه مثبت رنگ قابل تنظیم را تنظیم کنید
                dialog.getPositiveButtonTextView()!!.text = positiveText //متن دکمه مثبت را تنظیم کنید
                
                dialog.getNegativeButtonIconView()!!.setImageDrawable(negativeIcon) //نماد دکمه منفی قابل تنظیم است
                dialog.getNegativeButtonIconView()!!.setColorFilter(negativeIconColor) //نماد دکمه منفی رنگ قابل تنظیم را تنظیم کنید
                dialog.getNegativeButtonTextView()!!.text = negativeText //متن دکمه منفی را تنظیم کنید                
                dialog.getGotItButtonIconView()!!.setImageDrawable(gotItIcon) //آیکون آن را تنظیم کرد
                dialog.getGotItButtonIconView()!!.setColorFilter(gotItIconColor) //نماد دکمه منفی رنگ قابل تنظیم را تنظیم کنید
                dialog.getGotItButtonTextView()!!.text = gotItText //مجموعه متن دکمه را دریافت کرد
                
                dialog.getPositiveButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //متن دکمه مثبت را مخفی کنید
                dialog.getNegativeButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //متن دکمه منفی را مخفی کنید

                dialog.getGotItButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //متن متن دکمه را مخفی کنید                
                dialog.getPositiveButton()!!.visibility = if (hidePositiveButton) View.GONE else View.VISIBLE //دکمه مثبت را مخفی کنید
                dialog.getNegativeButton()!!.visibility = if (hideNegativeButton) View.GONE else View.VISIBLE //دکمه منفی را مخفی کنید
                dialog.getGotItButton()!!.visibility = if (hideGotItButton) View.GONE else View.VISIBLE  //دکمه مخفی کردن
            }
            

و در نهایت سورس کد با کامنیت و توضیحات انگلیسی کلی در مورد تمامی بخش ها :

نکته : جهت حذف کامنیت از کنترل + اینتر استفاده کنید و یا بلعکس در اندروید استودیو

 val dialog = ElegantDialog(context)
                .setTitleIcon(titleIcon)//Set title icon drawable
                .setTitleIconBackgroundColor(backgroundIconColor) //Set title icon drawable background color
                .setBackgroundTopColor(backgroundTopColor)// Set top color
                .setBackgroundBottomColor(backgroundBottomColor) // Set bottom color
                .setCustomView(R.layout.custom_image_layout)//Set custom layout
                .setCornerRadius(50f) //Set dialog corner radius
                .setCanceledOnTouchOutside(false) // Dismiss on tap outside
                .setTitleHidden(false) // Hide title
                .setElegantActionClickListener(object :
                    ElegantActionListeners {
                    override fun onPositiveListener(dialog: ElegantDialog) {
                      
                        dialog.dismiss()
                    }

                    override fun onNegativeListener(dialog: ElegantDialog) {
                        dialog.dismiss()
                    }

                    override fun onGotItListener(dialog: ElegantDialog) {

                        dialog.dismiss()
                    }

                    override fun onCancelListener(dialog: DialogInterface) {
                        dialog.dismiss()
                    }
                })
                .show()  // Finally don't forget to call show()
                
                 // access your customView
             val contentView: View? = dialog.getCustomView()
              
            // Now for the title, content and buttons customisations
            if (dialog.getTitleIconView() != null) {
                // You can use glide or picasso to display your own title image
                val imageUrl = R.drawable.face
                Glide.with(this).load(imageUrl)
                    .transition(ImageUtils.requestAvatarTransitionOptions())
                    .apply(ImageUtils.requestAvatarOptions("app"))
                    .into(dialog.getTitleIconView()!!)
                    
                dialog.getTitleTextView()!!.text = titleText //Set title text
                dialog.getTitleTextView()!!.setTextColor(titleTextColor) //Set title text color
                
                dialog.getContentTextView()!!.text = contentText //Set content text
                dialog.getContentTextView()!!.setTextColor(contentTextColor) //Set content text color
                
                dialog.getPositiveButtonIconView()!!.setImageDrawable(positiveIcon) //Set positive button icon drawable
                dialog.getPositiveButtonIconView()!!.setColorFilter(positiveIconColor) //Set positive button icon drawable color
                dialog.getPositiveButtonTextView()!!.text = positiveText //Set positive button text
                
                dialog.getNegativeButtonIconView()!!.setImageDrawable(negativeIcon) //Set negative button icon drawable
                dialog.getNegativeButtonIconView()!!.setColorFilter(negativeIconColor) //Set negative button icon drawable color
                dialog.getNegativeButtonTextView()!!.text = negativeText //Set negative button text
                
                dialog.getGotItButtonIconView()!!.setImageDrawable(gotItIcon) //Set got it button icon drawable
                dialog.getGotItButtonIconView()!!.setColorFilter(gotItIconColor) //Set negative button icon drawable color
                dialog.getGotItButtonTextView()!!.text = gotItText //Set got it button text
                
                dialog.getPositiveButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //Hide positive button text
                dialog.getNegativeButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //Hide negative button text
                dialog.getGotItButtonTextView()!!.visibility = if (hideButtonText) View.GONE else View.VISIBLE //Hide got it button text
                
                dialog.getPositiveButton()!!.visibility = if (hidePositiveButton) View.GONE else View.VISIBLE //Hide positive button 
                dialog.getNegativeButton()!!.visibility = if (hideNegativeButton) View.GONE else View.VISIBLE //Hide negative button
                dialog.getGotItButton()!!.visibility = if (hideGotItButton) View.GONE else View.VISIBLE  //Hide got it button
            }

 

تصاویر بیشتر :

کتابخانه اندروید کاتلین Elegant Dialog Kotlin

درباره نویسنده

جواد محمدی هستم بنیان‌گذار سایت خانه اندروید در خدمتون هستیم با آموزش و مفاهیم برنامه نویسی اندروید-نزدیک به 10 سال هست در حوزه برنامه نویسی فعالیت می کنم. مسلط به kotlin,java,flutter,php هستم . در خانه اندروید دانستی های خودم را در اختیار تمامی علاقمندان به برنامه نویسی قرار میدم.تشکر از اینکه خانه اندرورید رو دنبال می کنید.

قبل از ارسال دیدگاه

  • قبل از ارسال دیدگاه: لطفا دیدگاه خودتون رو فقط در مورد این مطلب بنویسید.سپاسگزارم.

    دیدگاه های طولانی نادیده گرفته می شوند لذا دیدگاه خودتان را در دو خط خلاصه کنید.

    دیدگاه های که شامل توهین یا متن توهین آمیز اصلا تایید نمی شود.

    به دیدگاه های بی نام و نشان که ایمیل فیک و نام فیک وارد می کنند پاسخ داده نمی شود

بدون دیدگاه