Search code examples
bixby

Extra layout after select card with intent


Found this question in other place, similar to Start playing the audio after selecting card in results view and How to trigger onclick on selection in bixby but i am unable to comment to ask for further question, and i am so blur about the answer provided, so decided to open a new question.

What i want to achived is to display a list for user to choose and after user choose, it will play the news audio (action 'playnews').

So this is my view which connect to layout macro

render{
    list-of (this){
        has-details (true)
        where-each (one){

            layout-macro (display-list){
                param (one){
                    expression (one)
                }
            }
            spoken-summary("#{value(one)}")
        }
    }
}

And this is my layout-macro-def

layout-macro-def (display-list){
  params{
    param (one){
      type (userWantToHear)
      min (Required) max (One)
    }
  }

  content{
    cell-card{

      slot2{
        content{
          primary{
            template ("#{value(one)}"){
            }
          }
        }
      }
      on-click{
        intent{
          goal: playNews
        }
      }
    }
  }
}

What i achieved is when i clicked on the list of selection,

enter image description here

it bring me to another page with the topic i clicked just now, and the audio play only if i click the card on the new page shown.

enter image description here

Yes this question is similar to those i mentioned above, but i require a further explanation as i really blur about this (and yea i can't post a comment).I want to get rid of the one-extra-click before the audio play.

Thanks !


Solution

  • First the easy answer: Unfortunately, on-click does not work on list-of in result-view. So the extra page is required when doing the on-click way of the result-view.

    Now the useful answer: To implement the feature you want, an input-view with selection-of might be much easier than list-of in result-view. This might be difficult to explain in words, so I made a sample capsule, you can download it and try.

    In the two training examples provided, show me all titles use the result-view, and redirect using on-click. While play title directly use the action which triggers an input-view.

    As it shows here, no extra page, one click, the same result. enter image description here