Skip to content

Commit

Permalink
refactor: toast when no available provider was found
Browse files Browse the repository at this point in the history
  • Loading branch information
Mufanc committed May 23, 2024
1 parent 08a8d69 commit 2110867
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.asLiveData
import com.google.android.material.dialog.MaterialAlertDialogBuilder
Expand All @@ -31,6 +32,11 @@ class ScopeProviderSelectorDialog private constructor(
val service = AppLockService.client() ?: return null
val availableProviders = service.availableProviders.toSet()

if (availableProviders.isEmpty()) {
Toast.makeText(activity, R.string.message_no_available_provider, Toast.LENGTH_SHORT).show()
return null
}

Log.d(TAG, "available providers: $availableProviders")
Log.d(TAG, "disabled providers: ${disabledProviders.value?.all?.keys}")

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="settings_item_license_summary">点击查看</string>

<!-- scope providers -->
<string name="message_no_available_provider">无可用的提供器</string>
<string name="scope_provider_default">默认</string>
<string name="scope_provider_media_session">媒体会话</string>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<string name="settings_item_license_summary">Click to show</string>

<!-- scope providers -->
<string name="message_no_available_provider">No available provider</string>
<string name="scope_provider_default">Default</string>
<string name="scope_provider_media_session">Default</string>

Expand Down

0 comments on commit 2110867

Please sign in to comment.