1
0
Fork 0

No issue: Fix crash on bookmark folder selection and Snackbar color

master
Colin Lee 2019-04-20 11:26:44 -05:00
parent 080dadcb7e
commit 7c00c2983b
4 changed files with 9 additions and 10 deletions

View File

@ -92,8 +92,8 @@ class EditBookmarkFragment : Fragment(), CoroutineScope {
bookmark_name_edit.setText(bookmarkNode!!.title)
bookmark_url_edit.setText(bookmarkNode!!.url)
if (sharedViewModel.selectedFolder != null) {
val bookmarkPair = Pair(bookmarkNode?.title!!, bookmarkNode?.url!!)
if (sharedViewModel.selectedFolder != null && bookmarkNode?.title != null) {
val bookmarkPair = Pair(bookmarkNode?.title, bookmarkNode?.url)
updateBookmarkNode(bookmarkPair)
}
}
@ -160,7 +160,7 @@ class EditBookmarkFragment : Fragment(), CoroutineScope {
}
}
private fun updateBookmarkNode(pair: Pair<String, String>) {
private fun updateBookmarkNode(pair: Pair<String?, String?>) {
launch(IO) {
try {
requireComponents.let {

View File

@ -15,7 +15,7 @@ import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.concept.storage.BookmarkNodeType
import mozilla.components.support.ktx.android.content.res.pxToDp
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getColorFromAttr
import org.mozilla.fenix.ext.getColorIntFromAttr
import org.mozilla.fenix.library.bookmarks.BookmarksSharedViewModel
class SelectBookmarkFolderAdapter(private val sharedViewModel: BookmarksSharedViewModel) :
@ -86,9 +86,9 @@ class SelectBookmarkFolderAdapter(private val sharedViewModel: BookmarksSharedVi
fun bind(folder: BookmarkNodeWithDepth, selected: Boolean, selectionInterface: SelectionInterface) {
val backgroundTint =
if (selected) {
R.attr.accent.getColorFromAttr(containerView!!.context)
R.attr.accentBright.getColorIntFromAttr(containerView!!.context)
} else {
R.attr.neutral.getColorFromAttr(containerView!!.context)
R.attr.neutral.getColorIntFromAttr(containerView!!.context)
}
val backgroundTintList = ContextCompat.getColorStateList(containerView.context, backgroundTint)

View File

@ -4,6 +4,6 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?accent" />
<solid android:color="?accentBright" />
<corners android:radius="8dp" />
</shape>

File diff suppressed because one or more lines are too long