Commit 2896ca01 authored by wanglei's avatar wanglei

...

parent e75feaf2
......@@ -186,9 +186,9 @@ object NotificationUiUtil {
}
fun setActionNotification(context: Context, actionId: String) {
val bigRemoteViews =
var bigRemoteViews =
RemoteViews(MyApplication.context.packageName, R.layout.notification_message)
val smallRemoteViews =
var smallRemoteViews =
RemoteViews(MyApplication.context.packageName, R.layout.notification_message)
val intent = Intent(context, SplashActivity::class.java)
intent.putExtra("actionId", actionId)
......@@ -215,58 +215,75 @@ object NotificationUiUtil {
}
NOTIFICATION_ACTION_SCREENSHOT -> {
val tittle = "Not enough storage space? Clean up screenshots to free up space."
val desc = context.getString(R.string.find_your_screenshot_clean_it)
bigRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
smallRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
val tittle = "Not enough storage space?"
val content = "Clean up screenshots to free up space."
smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_small)
bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_large)
smallRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setTextViewText(R.id.tv_title, tittle)
bigRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setImageViewResource(R.id.iv_image, R.mipmap.icon_screenshot_tools)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
NOTIFICATION_ACTION_SIMILAR -> {
val tittle = "Too many similar photos? Organize your memories and save space."
val desc = context.getString(R.string.find_your_similar_photos_to_clean_it)
bigRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
smallRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
val tittle = "Too many similar photos?"
val content = "Organize your memories and save space."
smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_small)
bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_large)
smallRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setTextViewText(R.id.tv_title, tittle)
bigRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setImageViewResource(R.id.iv_image, R.mipmap.icon_similar_tool)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
NOTIFICATION_ACTION_WHATSAPP -> {
val tittle = "Clear WhatsApp cache and free up space on your device!"
val desc = context.getString(R.string.whatsapp_pop)
bigRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
smallRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
// val tittle = "WhatsApp Clean"
val content = "Clear WhatsApp cache and free up space on your device!"
smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_small)
bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_large)
smallRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setTextViewText(R.id.tv_title, content)
// bigRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setImageViewResource(R.id.iv_image, R.mipmap.icon_whatsapp_tools)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
NOTIFICATION_ACTION_LARGEFILE -> {
val tittle = "One-tap cleanup of large files to free up your phone's storage."
val desc = context.getString(R.string.find_your_large_file_to_clean_it)
bigRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
smallRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
val content = "One-tap cleanup of large files to free up your phone's storage."
// val tittle = "Largefile Clean"
smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_small)
bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_common_large)
smallRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setTextViewText(R.id.tv_title, content)
// bigRemoteViews.setTextViewText(R.id.tv_content, content)
bigRemoteViews.setImageViewResource(R.id.iv_image, R.mipmap.icon_file_tool)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
NOTIFICATION_ACTION_ZODIAC -> {
val tittle = context.getString(R.string.zodiac)
smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_constellation_small)
bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_constellation_big)
val content = arrayOf(
"Your daily horoscope has the answers you seek. Click to discover!",
"Your horoscope opens new doors. Click to unlock your destiny!",
"Today's horoscope reveals life-changing secrets. Click to see!",
"Your daily horoscope maps your path to success. Click to find it!"
Pair("Unlock the Universe's Secrets!", "Your daily horoscope has the answers you seek. Click to discover!"),
Pair("Discover Your Hidden Fortune!", "Your horoscope opens new doors. Click to unlock your destiny!"),
Pair("Your Fate is in the Stars!", "Today's horoscope reveals life-changing secrets. Click to see!"),
Pair("Unlock Your Future Today!", "Your daily horoscope maps your path to success. Click to find it!"),
).random()
val desc = content
bigRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
smallRemoteViews.setTextViewText(R.id.tv_tittle, tittle)
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, content.second)
bigRemoteViews.setTextViewText(R.id.tv_title, content.first)
bigRemoteViews.setTextViewText(R.id.tv_desc, content.second)
sendCustomNotification(context, intent, bigRemoteViews, smallRemoteViews)
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/white_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_image"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@mipmap/icon_screenshot_tools"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="NestedWeights">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/color_181b1f"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Screenshot Clean" />
<TextView
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textColor="#999999"
android:textSize="14sp"
tools:text="aaaaa" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/gradient"
android:gravity="center"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/clean"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/colorPrimary"
android:textSize="16sp" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="8dp"
android:paddingEnd="12dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:gravity="center_vertical"
android:text="@string/notification_clean_junk"
android:textColor="@color/color_181b1f"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:text="@string/clean"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold"
android:background="@drawable/gradient" />
</LinearLayout>
<TextView
android:id="@+id/tv_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:textColor="@color/colorPrimary" />
</RelativeLayout>
\ No newline at end of file
<?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:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<ImageView
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:src="@mipmap/d_xingzuo"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="Check out your luck today!" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Check out your luck today!"
android:textColor="#999999"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tv_tittle_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#898989"
android:textSize="12sp"
android:visibility="gone"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_btn"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginHorizontal="25dp"
android:layout_marginVertical="16dp"
android:background="@drawable/bg_0571ed_25"
android:gravity="center"
android:text="View"
android:textColor="@color/white"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
\ No newline at end of file
<?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="60dp"
android:background="@drawable/bg_ffffff_15">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp"
android:src="@mipmap/x_xingzuo"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="7dp"
android:layout_marginEnd="40dp"
android:layout_weight="1"
android:textColor="@color/black"
android:textSize="14sp"
android:text="Check out your luck today!"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tv_btn"
android:layout_width="69dp"
android:layout_height="34dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="13dp"
android:background="@drawable/bg_0571ed_18"
android:gravity="center"
android:text="View"
android:textColor="@color/white"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
\ 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