mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
parent
af6e576423
commit
a002249fa2
2 changed files with 23 additions and 3 deletions
|
|
@ -34,8 +34,9 @@
|
|||
android:button="@drawable/daily_checkbox"
|
||||
android:gravity="center" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
<net.pherth.android.emoji_library.EmojiTextView
|
||||
android:id="@+id/text_view"
|
||||
style="@style/Subheader3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp" />
|
||||
|
|
|
|||
|
|
@ -16,10 +16,14 @@ import com.habitrpg.android.habitica.data.UserRepository
|
|||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.models.tasks.ChecklistItem
|
||||
import com.habitrpg.android.habitica.models.tasks.Task
|
||||
import com.habitrpg.android.habitica.ui.helpers.MarkdownParser
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindColor
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.functions.Consumer
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import net.pherth.android.emoji_library.EmojiTextView
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
|
@ -114,8 +118,23 @@ class YesterdailyDialog private constructor(context: Context, private val userRe
|
|||
} else {
|
||||
checkboxHolder.setBackgroundResource(task.lightTaskColor)
|
||||
}
|
||||
val textView = taskView.findViewById(R.id.text_view) as? TextView
|
||||
textView?.text = task.text
|
||||
|
||||
val emojiView = taskView.findViewById<View>(R.id.text_view) as? EmojiTextView
|
||||
if (task.parsedText != null) {
|
||||
emojiView?.text = task.parsedText
|
||||
} else {
|
||||
emojiView?.text = task.text
|
||||
|
||||
Single.just(task.text)
|
||||
.map { MarkdownParser.parseMarkdown(it) }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(Consumer{ parsedText ->
|
||||
task.parsedText = parsedText
|
||||
emojiView?.text = task.parsedText
|
||||
}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue