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newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 526b4c2..a2d7c21 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -13,7 +13,6 @@
-
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 121dd72..a24b858 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -11,6 +11,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
index a7d366e..3f40f55 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -12,8 +12,8 @@ android {
applicationId "ren.imyan.app_tracker"
minSdk 21
targetSdk 31
- versionCode 5
- versionName "0.0.5"
+ versionCode 6
+ versionName "0.0.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt b/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt
index c6db1ce..00a86e3 100644
--- a/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt
+++ b/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt
@@ -19,18 +19,22 @@ class AppTrackerRepo {
suspend fun submitAppInfo(info: AppInfo) =
flow {
+ var signature = "app-tracker"
+ if(info.activityName == ""){
+ signature = "builtin"
+ }
val appInfo = SubmitAppRequest(
activityName = info.activityName,
appName = info.appName,
packageName = info.packageName,
- signature = "app-tracker"
+ signature = signature
)
emit(api.submitAppInfo(appInfo))
}.flowOn(Dispatchers.IO)
- suspend fun submitAppIcon(packageName:String,icon: File) =
- flow{
+ suspend fun submitAppIcon(packageName: String, icon: File) =
+ flow {
val iconFile = icon.asRequestBody("image/jpeg".toMediaTypeOrNull());
- emit(api.submitAppIcon(packageName,iconFile))
+ emit(api.submitAppIcon(packageName, iconFile))
}.flowOn(Dispatchers.IO)
}
\ No newline at end of file
diff --git a/app/src/main/java/ren/imyan/app_tracker/ui/MainActivity.kt b/app/src/main/java/ren/imyan/app_tracker/ui/MainActivity.kt
index f232a7f..ec185ad 100644
--- a/app/src/main/java/ren/imyan/app_tracker/ui/MainActivity.kt
+++ b/app/src/main/java/ren/imyan/app_tracker/ui/MainActivity.kt
@@ -193,7 +193,7 @@ class MainActivity : BaseActivity() {
submitAll.setOnClickListener {
@Suppress("UNCHECKED_CAST")
val checkedList =
- (binding.appList.models as List).filter { it.isCheck }
+ (binding.appList.models as List).filter { it.isCheck && it.activityName != "" }
if (checkedList.isEmpty()) {
return@setOnClickListener
}
@@ -292,6 +292,7 @@ class MainActivity : BaseActivity() {
R.id.only_system_app -> viewModel.dispatch(MainAction.FilterApp(FilterAppType.System))
R.id.all_app -> viewModel.dispatch(MainAction.FilterApp(FilterAppType.All))
R.id.about -> startActivity(Intent(this, AboutActivity::class.java))
+ R.id.none_activity -> viewModel.dispatch(MainAction.SwitchToShowNoneActivityNameApp)
}
return super.onOptionsItemSelected(item)
}
diff --git a/app/src/main/java/ren/imyan/app_tracker/ui/MainView.kt b/app/src/main/java/ren/imyan/app_tracker/ui/MainView.kt
index 9a379ba..4df8890 100644
--- a/app/src/main/java/ren/imyan/app_tracker/ui/MainView.kt
+++ b/app/src/main/java/ren/imyan/app_tracker/ui/MainView.kt
@@ -31,4 +31,5 @@ sealed class MainAction : UiAction {
data class Search(val type: String) : MainAction()
data class SaveIcon(val icon: Bitmap?, val appName: String?) : MainAction()
data class ShareZip(val infoList: List? = null) : MainAction()
+ object SwitchToShowNoneActivityNameApp : MainAction()
}
\ No newline at end of file
diff --git a/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt b/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt
index 151fa84..2b94a66 100644
--- a/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt
+++ b/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt
@@ -30,6 +30,7 @@ class MainViewModel : BaseViewModel() {
private var currProgress = 0
private var allAppList: MutableList? = null
private var currAppList: MutableList? = null
+ private var showNoneActivityNameApp = false
init {
viewModelScope.launch(Dispatchers.IO) {
@@ -61,6 +62,10 @@ class MainViewModel : BaseViewModel() {
}
is MainAction.SaveIcon -> saveIcon(action.icon, action.appName)
is MainAction.ShareZip -> action.infoList?.let { shareZip(it) }
+ MainAction.SwitchToShowNoneActivityNameApp ->{
+ showNoneActivityNameApp = !showNoneActivityNameApp
+ filterActivityName()
+ }
}
}
@@ -88,8 +93,8 @@ class MainViewModel : BaseViewModel() {
appInfoList.sortBy {
it.appName
}
- allAppList = appInfoList.filter { it.activityName != "" }.toMutableList()
- currAppList = appInfoList.filter { it.activityName != "" }.toMutableList()
+ allAppList = appInfoList.toMutableList()
+ currAppList = appInfoList.toMutableList()
emitData {
copy(
appInfoList = BaseLoad.Success(appInfoList.filter { it.activityName != "" })
@@ -143,35 +148,32 @@ class MainViewModel : BaseViewModel() {
allAppList?.let {
val newList = it.filter { data -> data.isSystem == false }
currAppList = newList.toMutableList()
- emitData {
- copy(
- appInfoList = BaseLoad.Success(newList.toMutableList())
- )
- }
}
}
FilterAppType.System -> {
allAppList?.let {
val newList = it.filter { data -> data.isSystem == true }
currAppList = newList.toMutableList()
- emitData {
- copy(
- appInfoList = BaseLoad.Success(newList.toMutableList())
- )
- }
}
}
FilterAppType.All -> {
allAppList?.let {
currAppList = it.toMutableList()
- emitData {
- copy(
- appInfoList = BaseLoad.Success(it.toMutableList())
- )
- }
}
}
}
+ filterActivityName()
+ }
+
+ private fun filterActivityName() {
+ currAppList?.let {
+ val newList = it.filter { data -> (data.activityName == "") == showNoneActivityNameApp }
+ emitData {
+ copy(
+ appInfoList = BaseLoad.Success(newList.toMutableList())
+ )
+ }
+ }
}
private fun submitAppInfo(infoList: List) {
diff --git a/app/src/main/res/menu/toolbar.xml b/app/src/main/res/menu/toolbar.xml
index 0e49a85..05bf2f4 100644
--- a/app/src/main/res/menu/toolbar.xml
+++ b/app/src/main/res/menu/toolbar.xml
@@ -35,6 +35,11 @@
app:showAsAction="never"
android:title="显示所有"/>
+
+