-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from aquamarine5/1.3-dev
UDCA included to collect UsageData, +Bugly to trace
- Loading branch information
Showing
37 changed files
with
698 additions
and
163 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
# OnceShot | ||
# OnceShot | ||
## OnceShot 是什么? | ||
- OnceShot 是作者高二的创意,因为自己的截图太多(达到了2000张),很多截图分享给别人用一次也就用不上了,但是有些截图想保留着,就打算做个分类App,把一次性的截图分享给别人之后就删除,这样自己的截图文件夹就只有想要一直留存的图片了 | ||
- OnceShot 的最新版本是v1.3.0.0(2024/05/02),更多内容可以看[Releases](https://github.com/aquamarine5/OnceShot/releases)的Changelog | ||
### Examples | ||
- 听到了一首好好听的歌,截图分享给别人,这时候点击**分享后删除**,不占用手机空间 | ||
- 打游戏的时候碰到了有意思的事,截图分享给别人,这时候点击**关闭**,永远留存下来 ![Screenshot_20240501_162000.jpg](https://s2.loli.net/2024/05/01/yDLkRTlMxgw6HC9.jpg) | ||
- 买东西的时候商家邀请截图发给客服,但是没办法直接通过分享渠道发过去,这时候点击**等等我...**,确定发送成功之后再删除 | ||
- 截图的时候发现截错了,这时候点击**直接删除**,就不用担心一会发送截图的时候会发错啦 | ||
## 如何使用? | ||
- 先下载([点我跳转到最新版本的Release](https://github.com/aquamarine5/OnceShot/releases/latest)),在Assets里面找到`app-release.apk`(或者是`app-debug.apk`)下载安装 | ||
- 第一次打开 OnceShot 时,服务并不会启动,把权限全部授予给 OnceShot 后,服务即可正常启动 | ||
- 完成了上面两步,现在截个图,如果出现了 OnceShot 的操作面板悬浮窗,说明设置成功🎉 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
namespace 'org.aquarngd.announcement' | ||
compileSdk 34 | ||
|
||
defaultConfig { | ||
minSdk 24 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
buildFeatures{ | ||
buildConfig=true | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.13.0' | ||
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0') | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.11.0' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
4 changes: 4 additions & 0 deletions
4
announcement/src/main/java/org/aquarngd/announcement/AnnouncementService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.aquarngd.announcement | ||
|
||
class AnnouncementService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.aquarngd.onceshot | ||
|
||
import org.aquarngd.udca.UsageDataKey | ||
|
||
data class AnalysisDataClass( | ||
var key: UsageDataKey, | ||
var str:String, | ||
var value:Int | ||
) |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/org/aquarngd/onceshot/AnalysisDataKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.aquarngd.onceshot | ||
|
||
import org.aquarngd.udca.UsageDataKey | ||
|
||
class AnalysisDataKey { | ||
companion object{ | ||
val SCREENSHOT_COUNT=UsageDataKey("sc") | ||
val CLICK_DELETE_DIRECTLY=UsageDataKey("cd", listOf(SCREENSHOT_COUNT)) | ||
val CLICK_CLOSE=UsageDataKey("cc", listOf(SCREENSHOT_COUNT)) | ||
val TIMEOUT_CLOSE=UsageDataKey("tc", listOf(SCREENSHOT_COUNT)) | ||
val CLICK_WAITING=UsageDataKey("cw", listOf(SCREENSHOT_COUNT)) | ||
val CLICK_WAITING_DELETE=UsageDataKey("cwd", listOf(CLICK_WAITING)) | ||
val CLICK_WAITING_IGNORE=UsageDataKey("cwi", listOf(CLICK_WAITING)) | ||
val CLICK_DELETE_AFTER_SHARE=UsageDataKey("ca", listOf(SCREENSHOT_COUNT)) | ||
val SETTING_DURATION="d" | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
app/src/main/java/org/aquarngd/onceshot/AnalysisService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.aquarngd.onceshot | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import com.tencent.bugly.crashreport.CrashReport | ||
import org.aquarngd.udca.BuglyUsageDataAnalyser | ||
import java.time.Instant | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
|
||
class AnalysisService { | ||
companion object{ | ||
const val SETTING_DURATION="sd" | ||
const val LAST_UPLOAD_TIME="last_upload_time" | ||
const val UPLOAD_INTERVAL=86400000L | ||
val UPLOAD_USAGE_VALUES= listOf( | ||
AnalysisDataKey.SCREENSHOT_COUNT, | ||
AnalysisDataKey.TIMEOUT_CLOSE, | ||
AnalysisDataKey.CLICK_CLOSE, | ||
AnalysisDataKey.CLICK_DELETE_DIRECTLY, | ||
AnalysisDataKey.CLICK_DELETE_AFTER_SHARE, | ||
AnalysisDataKey.CLICK_WAITING, | ||
AnalysisDataKey.CLICK_WAITING_DELETE, | ||
AnalysisDataKey.CLICK_WAITING_IGNORE | ||
) | ||
val USAGE_VALUES_STRING= mapOf( | ||
AnalysisDataKey.SCREENSHOT_COUNT to "截图次数", | ||
AnalysisDataKey.TIMEOUT_CLOSE to "悬浮窗自动关闭", | ||
AnalysisDataKey.CLICK_CLOSE to "点击悬浮窗关闭", | ||
AnalysisDataKey.CLICK_DELETE_DIRECTLY to "点击直接删除", | ||
AnalysisDataKey.CLICK_DELETE_AFTER_SHARE to "点击分享后删除", | ||
AnalysisDataKey.CLICK_WAITING to "点击等等我", | ||
AnalysisDataKey.CLICK_WAITING_DELETE to "等等我后删除", | ||
AnalysisDataKey.CLICK_WAITING_IGNORE to "等等我后保留" | ||
) | ||
} | ||
|
||
fun tryUpload(context: Context){ | ||
if(checkNeedUpload(context)){ | ||
upload(context) | ||
} | ||
} | ||
fun upload(context: Context){ | ||
val sb=StringBuilder() | ||
val sp=getSharedPreferences(context) | ||
UPLOAD_USAGE_VALUES.forEach { | ||
sb.append("${it.key}:${sp.getInt(it.key,0)}; ") | ||
} | ||
sb.append("d: ${sp.getInt(AnalysisDataKey.SETTING_DURATION,30)}") | ||
BuglyUsageDataAnalyser().upload(sb.toString()) | ||
sp.edit().putLong(LAST_UPLOAD_TIME,System.currentTimeMillis()).apply() | ||
} | ||
fun checkNeedUpload(context: Context): Boolean { | ||
val time=getSharedPreferences(context).getLong(LAST_UPLOAD_TIME,0) | ||
return System.currentTimeMillis()-time> UPLOAD_INTERVAL | ||
} | ||
private fun getSharedPreferences(context: Context):SharedPreferences{ | ||
return context.getSharedPreferences("UDCA_SP",Context.MODE_PRIVATE) | ||
} | ||
} |
Oops, something went wrong.