提现通知 UI 布局
This commit is contained in:
parent
191d19a908
commit
705901d55c
|
|
@ -16,6 +16,7 @@ import androidx.core.app.NotificationManagerCompat
|
|||
import com.ama.core.architecture.BaseApp
|
||||
import com.ama.core.architecture.util.permission.PermissionUtil
|
||||
import com.remax.notification.NotifyConst
|
||||
import com.remax.notification.R
|
||||
|
||||
class NotificationUtil private constructor() {
|
||||
|
||||
|
|
@ -394,7 +395,42 @@ class NotificationUtil private constructor() {
|
|||
|
||||
}
|
||||
|
||||
fun showExpandableNotification(notifiConfig: NotificationConfig) {
|
||||
val notificationId = notifiConfig.notificationId
|
||||
val channelId = notifiConfig.channelId
|
||||
val channelName = notifiConfig.channelName
|
||||
val title = notifiConfig.title
|
||||
val content = notifiConfig.content
|
||||
val smallIcon = notifiConfig.smallIcon
|
||||
val pendingIntent = notifiConfig.intent
|
||||
val useFullScreenIntent = notifiConfig.useFullScreenIntent
|
||||
|
||||
// 1. collapse
|
||||
val collapsedView = RemoteViews(mContext.packageName, R.layout.layout_notification_withdraw)
|
||||
collapsedView.setTextViewText(R.id.tvTitle, title)
|
||||
collapsedView.setTextViewText(R.id.tvDesc, content)
|
||||
collapsedView.setOnClickPendingIntent(R.id.tvAction, pendingIntent)
|
||||
|
||||
// 2. expand
|
||||
val expandedView = RemoteViews(mContext.packageName, R.layout.layout_notification_withdraw_big)
|
||||
collapsedView.setTextViewText(R.id.tvTitle, title)
|
||||
collapsedView.setTextViewText(R.id.tvDesc, content)
|
||||
expandedView.setImageViewResource(R.id.ivBottom, R.drawable.vidi_withdraw_bottom)
|
||||
collapsedView.setOnClickPendingIntent(R.id.tvAction, pendingIntent)
|
||||
collapsedView.setOnClickPendingIntent(R.id.ivBottom, pendingIntent)
|
||||
|
||||
// 3. build
|
||||
val builder = NotificationCompat.Builder(mContext, channelId)
|
||||
.setSmallIcon(smallIcon)
|
||||
.setCustomContentView(collapsedView)
|
||||
.setCustomBigContentView(expandedView)
|
||||
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent)
|
||||
|
||||
showNotification(notificationId, builder.build(), channelName)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -353,7 +353,8 @@ class NotificationTimingController private constructor() : LifecycleObserver {
|
|||
val hasClaimedSmallCash = SpUtil.instance().getObject<TaskStateNewBieFirstWithDraw2>(SpUtil.KEY_NEWBIE_FIRST_WITHDRAW)?.hasClaimReward
|
||||
NotificationDatas.getConfigForType(NOTI_TYPE_BG_WITHDRAW)?.let {
|
||||
it.content = String.format(it.content, if (hasClaimedSmallCash == null || !hasClaimedSmallCash) 0.1 else 50)
|
||||
NotificationUtil.getInstance().showHeadsUpNotification(it)
|
||||
//NotificationUtil.getInstance().showHeadsUpNotification(it)
|
||||
NotificationUtil.getInstance().showExpandableNotification(it)
|
||||
|
||||
NotificationRecorder.saveLastNotifyShowTime(notifyType, DateUtil.getCurTimeMs())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/noti_bg_r16_white"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="ResourceName"
|
||||
android:padding="12dp" >
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 上半部分:同折叠布局 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:text="Hey there!"
|
||||
android:lines="1"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
tools:text="title" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDesc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:text="xxxR$0,1 está pronto por você! Saque agora!"
|
||||
android:textColor="#666666"
|
||||
android:textSize="12sp"
|
||||
tools:text="desc" />
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
@ -51,6 +42,7 @@
|
|||
android:background="@drawable/noti_bg_button_primary"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/vidi_go"
|
||||
android:textColor="#fff"
|
||||
|
|
@ -58,4 +50,3 @@
|
|||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,47 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/noti_bg_r16_white"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="ResourceName"
|
||||
android:padding="12dp">
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 上半部分:同折叠布局 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:text="Hey there!"
|
||||
android:lines="1"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
tools:text="title" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDesc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:text="xxxR$0,1 está pronto por você! Saque agora!"
|
||||
android:textColor="#666666"
|
||||
android:textSize="12sp"
|
||||
tools:text="desc" />
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
@ -51,22 +42,26 @@
|
|||
android:background="@drawable/noti_bg_button_primary"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/vidi_go"
|
||||
android:textColor="#fff"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 新增的大图部分 -->
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:background="#FFF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/vidi_withdraw_bottom"
|
||||
/>
|
||||
|
||||
|
||||
android:src="@drawable/vidi_withdraw_bottom" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
<?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:padding="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 上半部分:同折叠布局 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hey there!"
|
||||
android:lines="1"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDesc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxR$0,1 está pronto por você! Saque agora!"
|
||||
android:textColor="#666666"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAction"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/noti_bg_button_primary"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/vidi_go"
|
||||
android:textColor="#fff"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?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:padding="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 上半部分:同折叠布局 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hey there!"
|
||||
android:lines="1"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDesc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxR$0,1 está pronto por você! Saque agora!"
|
||||
android:textColor="#666666"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAction"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/noti_bg_button_primary"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/vidi_go"
|
||||
android:textColor="#fff"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 新增的大图部分 -->
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:background="#FFF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/vidi_withdraw_bottom" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue