Closed sanao1006 closed 1 year ago
いいですね
一旦投票件数の実装の方針とか考えてここに書いてもらえますか?
おおまかですが方針を考えてみました。
最初はPollListLinearLayoutBinder.bindPollChoices
にコードを書き足す方針で行こうかなと思ったのですが、うまくいかなかったので PollListLinearLayoutBinder
に新しい関数作って投票件数を表示させる方針にしました
PollListLinearLayoutBinder
にこんな感じの実装の関数bindVoteResult()
を追加
fun bindVoteResult(
layout: LinearLayout,
totalVoteCount: Int
) {
val binding = ItemVoteResultBinding.inflate(LayoutInflater.from(layout.context), layout, false)
binding.voteResult.text = layout.context.getString(R.string.total_vote_count, totalVoteCount.toString())
layout.addView(binding.root)
}
item_vote_result.xml
レイアウト追加。左寄せのTextViewのみ設置 (idはvoteResult
)%s votes in total
みたいなstringを追加 (nameはtotal_vote_count
)totalVoteCount
を%sに代入PollHelper
でPollListLinearLayoutBinder.bindPollChoices
の真下あたりに以下のように実装して画面に投票数を反映させる
PollListLinearLayoutBinder.bindVoteResult(this, poll.totalVoteCount)
いちおうこんな感じで実装してみたところ見た目はこんな感じになりました (命名は割と雑かもです)。
良いと思います🙆♀
引き続きよろしくお願いします🙇🙇
とりあえずPR作成してみました。お手すきの際にご確認お願いします!
概要
タイトルの通りです。 Web版のように現在何票投票されているかの表示がmilkteaにもあれば便利かなと思いました(画像赤線部分)。
具体的な実装方法などはまだ考えていないですが、もしこの機能がアリならば実装をしてみたいです! 「結果を見る」や「投票する・投票済み」などの機能はもしこのissueが採用されるなら合わせて実装すべきかもです(issueは分けるべきかも?)
追記
いつもmilktea使わせてもらっています!本当に使いやすくて最高です!