Commit 8fd79a0e by zhangchengbo

feat:长按桌面Icon[日志导出]功能

parent 9465b23a
...@@ -277,7 +277,11 @@ ...@@ -277,7 +277,11 @@
<action android:name="android.service.notification.NotificationListenerService" /> <action android:name="android.service.notification.NotificationListenerService" />
</intent-filter> </intent-filter>
</service>--> </service>-->
<activity
android:name=".shortcut.ShortCutActivity"
android:excludeFromRecents="true"
android:resizeableActivity="true"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>
...@@ -25,4 +25,6 @@ object Constant { ...@@ -25,4 +25,6 @@ object Constant {
val listThreadData = arrayListOf<String>()//记录被删除的消息包含[零宽度字符]的手机号 val listThreadData = arrayListOf<String>()//记录被删除的消息包含[零宽度字符]的手机号
const val EXPORT_LOG= "com.dialer.export_log"
} }
package com.secspace.sms.shortcut
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.secspace.log.Callback
import com.secspace.log.Log
import com.secspace.sms.helpers.Constant
import com.simplemobiletools.commons.extensions.toast
/**
* Created by Gz on 2024/3/5.
*/
class ShortCutActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = intent
Log.d("ShortCutActivity", "initData: action=${intent.action}")
when(intent.action){
Constant.EXPORT_LOG ->{
Log.exportLogsAsync(getExternalFilesDir("logs")!!.absolutePath,object : Callback{
override fun onSuccess() {
toast("日志导出成功!")
finish()
}
override fun onFailure(e: Exception) {
toast("日志导出失败! exception=${e.message}")
finish()
}
})
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shortcut_update_background">
<shape android:shape="oval">
<solid android:color="@color/color_primary" />
</shape>
</item>
<item
android:drawable="@drawable/ic_article_vector"
android:bottom="@dimen/smaller_margin"
android:left="@dimen/smaller_margin"
android:right="@dimen/smaller_margin"
android:top="@dimen/smaller_margin" />
</layer-list>
...@@ -133,4 +133,6 @@ ...@@ -133,4 +133,6 @@
Haven't found some strings? There's more at Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
--> -->
<string name="shortcuts_back_short_label">日志导出</string>
</resources> </resources>
...@@ -135,6 +135,8 @@ ...@@ -135,6 +135,8 @@
<string name="faq_3_text">Yes, you can schedule messages to be sent in the future by long pressing the Send button and picking the desired date and time.</string> <string name="faq_3_text">Yes, you can schedule messages to be sent in the future by long pressing the Send button and picking the desired date and time.</string>
<string name="new_tips_notif">您收到一条新的消息!</string> <string name="new_tips_notif">您收到一条新的消息!</string>
<string name="shortcuts_back_short_label">日志导出</string>
<!-- <!--
Haven't found some strings? There's more at Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
......
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="background_settings"
android:enabled="true"
android:icon="@mipmap/export_log"
android:shortcutShortLabel="@string/shortcuts_back_short_label">
<intent
android:action="com.mdmoffline.EXPORT_LOG"
android:targetPackage="com.secspace.sms"
android:targetClass="com.secspace.sms.shortcut.ShortCutActivity" />
<categories android:name="android.app.shortcuts"/>
</shortcut>
</shortcuts>
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