Commit 2f3b994a by zhangchengbo

fix:新增消息内容弹窗(呼叫,发送短信,添加通讯录等);

parent 9c0fe25b
package com.secspace.sms.popup
import android.content.Context
import android.view.Gravity
import android.view.animation.Animation
import android.widget.TextView
import com.secspace.sms.R
import razerdp.basepopup.BasePopupWindow
import razerdp.util.animation.AnimationHelper
import razerdp.util.animation.Direction
import razerdp.util.animation.TranslationConfig
class TipPopup(mContext: Context, private val sureResult: (Int,String) -> Unit) : BasePopupWindow(mContext) {
private val tvPhoneNumber by lazy { findViewById<TextView>(R.id.tv_phone_number) }
private val tvCallPhone by lazy { findViewById<TextView>(R.id.tv_call_phone) }
private val tvCallPhoneEdit by lazy { findViewById<TextView>(R.id.tv_call_phone_edit) }
private val tvSendSms by lazy { findViewById<TextView>(R.id.tv_send_sms) }
private val tvCopy by lazy { findViewById<TextView>(R.id.tv_copy_phone_number) }
private val tvAddContacts by lazy { findViewById<TextView>(R.id.tv_add_contacts) }
private val tvCancel by lazy { findViewById<TextView>(R.id.tv_cancel_pop) }
private var phoneNumbers :String = ""
init {
setContentView(R.layout.d_ui_tips_popup)
setBlurBackgroundEnable(false)
setOutSideDismiss(false)
setBackPressEnable(false)
popupGravity = Gravity.BOTTOM
tvCancel.setOnClickListener {
dismiss()
}
tvCallPhone.setOnClickListener {
sureResult.invoke(1,phoneNumbers)
dismiss()
}
tvCallPhoneEdit.setOnClickListener {
sureResult.invoke(2,phoneNumbers)
dismiss()
}
tvSendSms.setOnClickListener {
sureResult.invoke(3,phoneNumbers)
dismiss()
}
tvCopy.setOnClickListener {
sureResult.invoke(4,phoneNumbers)
dismiss()
}
tvAddContacts.setOnClickListener {
sureResult.invoke(5,phoneNumbers)
dismiss()
}
}
fun setPhoneNumberData(phoneNumber: String) {
tvPhoneNumber.text = phoneNumber
phoneNumbers = phoneNumber
}
override fun onCreateShowAnimation(): Animation {
return AnimationHelper.asAnimation()
.withTranslation(
TranslationConfig()
.from(Direction.BOTTOM)
.to(Direction.IDLE)
)
.toShow()
}
/* override fun onCreateDismissAnimation(): Animation {
return AnimationHelper.asAnimation()
.withTranslation(
TranslationConfig()
.from(Direction.TOP)
.to(Direction.IDLE)
)
.toShow()
}*/
}
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/md_blue_grey_300"/>
<corners android:radius="20dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@android:color/white"/>
<corners android:radius="18dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@drawable/tips_background"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="XXX"
android:textColor="@color/md_grey_black"
android:textSize="18sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_call_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp"
android:minHeight="30dp"
android:text="呼叫"
android:textColor="@color/md_grey_black"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_marginStart="20dp"
android:layout_marginEnd="15dp"
android:background="@color/divider_grey" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_call_phone_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:minHeight="30dp"
android:text="呼叫前编辑"
android:textColor="@color/md_grey_black"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_marginStart="20dp"
android:layout_marginEnd="15dp"
android:background="@color/divider_grey" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_send_sms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:minHeight="30dp"
android:text="发送短信"
android:textColor="@color/md_grey_black"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_marginStart="20dp"
android:layout_marginEnd="15dp"
android:background="@color/divider_grey" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_copy_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:minHeight="30dp"
android:text="复制到剪贴板"
android:textColor="@color/md_grey_black"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_marginStart="20dp"
android:layout_marginEnd="15dp"
android:background="@color/divider_grey" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_add_contacts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:minHeight="35dp"
android:text="新建联系人"
android:textColor="@color/md_grey_black"
android:textSize="16sp" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_cancel_pop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center"
android:minHeight="50dp"
android:text="取消"
android:textColor="@color/md_blue"
android:textSize="18sp" />
</LinearLayout>
......@@ -1005,9 +1005,9 @@ fun Context.getCornerRadius() = resources.getDimension(R.dimen.rounded_corner_ra
// we need the Default Dialer functionality only in Simple Dialer and in Simple Contacts for now
fun Context.isDefaultDialer(): Boolean {
return if (!packageName.startsWith("com.secspace.contacts") && !packageName.startsWith("com.secspace.dialer")) {
return if (!packageName.startsWith(Const.PACKAGE_CONTACTS) && !packageName.startsWith(Const.PACKAGE_DIALER)) {
true
} else if ((packageName.startsWith("com.secspace.contacts") || packageName.startsWith("com.secspace.dialer")) && isQPlus()) {
} else if ((packageName.startsWith(Const.PACKAGE_CONTACTS) || packageName.startsWith(Const.PACKAGE_DIALER)) && isQPlus()) {
val roleManager = getSystemService(RoleManager::class.java)
roleManager!!.isRoleAvailable(RoleManager.ROLE_DIALER) && roleManager.isRoleHeld(RoleManager.ROLE_DIALER)
} else {
......
......@@ -61,6 +61,7 @@
<dimen name="cab_item_min_width">85dp</dimen>
<dimen name="popup_menu_elevation">4dp</dimen>
<dimen name="divider_height">2px</dimen>
<dimen name="divider_height_one">1px</dimen>
<dimen name="contact_grid_item_max_size">100dp</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment