Commit de9432a7 authored by wanglei's avatar wanglei

...

parent f45603e4
......@@ -63,4 +63,7 @@ dependencies {
//solar 归因
implementation("com.reyun.solar.engine.oversea:solar-engine-core:1.2.8.3")
//第三方UI控件
implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
}
\ No newline at end of file
package com.base.appzxhy.ui.views
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.os.Build
import android.provider.Settings
import android.view.Gravity
import android.view.LayoutInflater
import com.base.appzxhy.R
import com.base.appzxhy.databinding.DialogNotificationTurnOnBinding
import com.base.appzxhy.utils.ActivityLauncher
object NotificationDialog {
@SuppressLint("SetTextI18n")
fun Context.showNotificationTurnOn(launcher: ActivityLauncher) {
val dialog = AlertDialog.Builder(this).create()
val binding = DialogNotificationTurnOnBinding.inflate(LayoutInflater.from(this))
dialog.setView(binding.root)
dialog.setCanceledOnTouchOutside(true)
dialog.show()
val params = dialog.window?.attributes
// params?.width = resources.getDimensionPixelOffset(R.dimen.dp_320)
// params?.height = LinearLayout.LayoutParams.WRAP_CONTENT
params?.gravity = Gravity.BOTTOM
// params?.y = 50
dialog.window?.attributes = params
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
val appName = resources.getString(R.string.app_name)
binding.tvTip.text = "Never miss important $appName notification reminders"
binding.ivClose.setOnClickListener {
dialog.dismiss()
}
binding.tvTurnOn.setOnClickListener {
dialog.dismiss()
val intent = Intent()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, this.packageName)
} else {
intent.action = "android.settings.APP_NOTIFICATION_SETTINGS"
intent.putExtra("app_package", this.packageName)
}
launcher.launch(intent)
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#03B988" />
<corners android:radius="35dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="324dp"
android:background="@mipmap/img_tongzhi_pop_bj"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="25dp"
android:src="@mipmap/icon_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:text="@string/turn_on_notification"
android:textColor="#1A1A1A"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="40dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:textColor="#666666"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_turn_on"
android:layout_width="259dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="40dp"
android:background="@drawable/bg_03b988_35"
android:gravity="center"
android:text="@string/turn_on"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -2,4 +2,6 @@
<string name="app_name">LocalWeatherWhite</string>
<string name="facebook_app_id">1324546913856392</string>
<string name="home">Home</string>
<string name="turn_on_notification">Turn on notification</string>
<string name="turn_on">Turn on</string>
</resources>
\ No newline at end of file
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