mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 05:27:10 +08:00
<powerbell> 优化 ChargeMailNotify 悬浮窗功能
1. 悬浮窗新增点击事件 - 点击悬浮窗打开应用主窗口 MainActivity - 打开主窗口后保持悬浮窗显示 2. 悬浮窗新增应用标题 - 显示 strings.xml 中的 app_name 字符串 - 标题样式加粗16sp,与内容区分
This commit is contained in:
+12
@@ -1,6 +1,7 @@
|
|||||||
package cc.winboll.studio.powerbell.utils;
|
package cc.winboll.studio.powerbell.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -8,6 +9,7 @@ import android.view.View;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.powerbell.R;
|
import cc.winboll.studio.powerbell.R;
|
||||||
|
import cc.winboll.studio.powerbell.MainActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电邮件通知悬浮窗工具类(单例)
|
* 充电邮件通知悬浮窗工具类(单例)
|
||||||
@@ -84,6 +86,16 @@ public class ChargeMailNotifyFloatWindow {
|
|||||||
|
|
||||||
// 加载悬浮窗布局
|
// 加载悬浮窗布局
|
||||||
mView = View.inflate(mContext, R.layout.view_charge_mail_notify, null);
|
mView = View.inflate(mContext, R.layout.view_charge_mail_notify, null);
|
||||||
|
// 点击悬浮窗打开主窗口
|
||||||
|
mView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LogUtils.d(TAG, "onClick: 悬浮窗被点击,打开主窗口");
|
||||||
|
Intent intent = new Intent(mContext, MainActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
mWindowManager.addView(mView, params);
|
mWindowManager.addView(mView, params);
|
||||||
LogUtils.d(TAG, "show() 悬浮窗显示成功");
|
LogUtils.d(TAG, "show() 悬浮窗显示成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -20,6 +20,14 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="#FF000000"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
Reference in New Issue
Block a user