Skip to content

Commit

Permalink
#1054 feat: make it clearer why the create launcher shortcut button i…
Browse files Browse the repository at this point in the history
…s disabled
  • Loading branch information
sds100 committed Jul 20, 2022
1 parent 57dac84 commit 1e0e772
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package io.github.sds100.keymapper.mappings.keymaps

import dagger.hilt.android.lifecycle.HiltViewModel
import io.github.sds100.keymapper.R
import io.github.sds100.keymapper.mappings.OptionMinimums
import io.github.sds100.keymapper.mappings.keymaps.trigger.TriggerFromOtherAppsListItem
import io.github.sds100.keymapper.ui.*
import io.github.sds100.keymapper.util.*
import io.github.sds100.keymapper.util.ui.*
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject

/**
Expand Down Expand Up @@ -111,7 +115,7 @@ class ConfigKeyMapTriggerOptionsViewModel @Inject constructor(
isEnabled = trigger.triggerFromOtherApps,
keyMapUid = keyMapUid,
label = getString(R.string.flag_trigger_from_other_apps),
showCreateLauncherShortcutButton = createKeyMapShortcut.isSupported
isCreateLauncherShortcutButtonEnabled = createKeyMapShortcut.isSupported
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ data class TriggerFromOtherAppsListItem(
val isEnabled: Boolean,
val keyMapUid: String,
val label: String,
val showCreateLauncherShortcutButton: Boolean
val isCreateLauncherShortcutButtonEnabled: Boolean
) : ListItem
5 changes: 3 additions & 2 deletions app/src/main/res/layout/list_item_trigger_from_other_apps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:onClick="@{onCreateLauncherShortcutClick}"
android:text="@string/button_create_keymap_shortcut_in_launcher"
android:visibility="@{model.showCreateLauncherShortcutButton && model.isEnabled ? View.VISIBLE : View.GONE}"
android:enabled="@{model.isCreateLauncherShortcutButtonEnabled}"
android:text="@{model.isCreateLauncherShortcutButtonEnabled ? @string/button_create_keymap_shortcut_in_launcher_enabled : @string/button_create_keymap_shortcut_in_launcher_disabled}"
android:visibility="@{model.isEnabled ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewUid" />
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@
<string name="button_yes">Yes!</string>
<string name="button_choose_action">Choose action</string>
<string name="button_add_intent_extra">Add extra</string>
<string name="button_create_keymap_shortcut_in_launcher">Create launcher shortcut</string>
<string name="button_create_keymap_shortcut_in_launcher_enabled">Create launcher shortcut</string>
<string name="button_create_keymap_shortcut_in_launcher_disabled">Create the shortcut manually</string>
<string name="button_open_trigger_keymap_from_intent_guide">Intent guide</string>
<string name="button_help">Help</string>
<string name="button_pick_coordinate_select_screenshot">Select Screenshot (optional)</string>
Expand Down

0 comments on commit 1e0e772

Please sign in to comment.