Skip to content

Commit

Permalink
Merge branch 'feature/1054-make-it-clearer-that-the-button-to-' into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
sds100 committed Jul 20, 2022
1 parent dfa9139 commit 0ac409e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ package io.github.sds100.keymapper.mappings.keymaps
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

/**
* Created by sds100 on 29/11/20.
Expand Down Expand Up @@ -109,7 +114,7 @@ class ConfigKeyMapTriggerOptionsViewModel(
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
3 changes: 3 additions & 0 deletions docs/user-guide/keymaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ This allows you to trigger the key map by using a shortcut or by sending an [Int

You can create a home screen shortcut by tapping "create launcher shortcut" or by adding the shortcut to your home screen in the same way as a widget. You can also use this shortcut from automation apps like Tasker and Automate without having to create a home screen shortcut.

!!! note
This button will be disabled if your launcher doesn't let 3rd party apps tell it to create shortcuts so you'll have to create it manually.

#### Intent

There are many apps that can automate broadcasting Intents such as Tasker and Automate.
Expand Down

0 comments on commit 0ac409e

Please sign in to comment.