Skip to content

Commit

Permalink
Add new bookmark styles
Browse files Browse the repository at this point in the history
Orange, purple and underline.
Fix AndBible#66, Ref AndBible#638
  • Loading branch information
JJK96 committed May 9, 2020
1 parent 1384e09 commit e822b1c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
27 changes: 19 additions & 8 deletions app/src/main/assets/web/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,31 @@ h1 a, .heading2, .heading3, .heading4 {
}

.YELLOW_HIGHLIGHT {
/* yellow */
background-color: rgba(255, 255, 0, 0.33);
/* yellow */
background-color: rgba(255, 255, 0, 0.33);
}
.RED_HIGHLIGHT {
/* green */
background-color: rgba(213, 0, 0, 0.28);
/* red */
background-color: rgba(213, 0, 0, 0.28);
}
.GREEN_HIGHLIGHT {
/* green */
background-color: rgba(0, 255, 0, 0.33);
/* green */
background-color: rgba(0, 255, 0, 0.33);
}
.BLUE_HIGHLIGHT {
/* blue A100 */
background-color: rgba(128, 216, 255, 0.33);
/* blue A100 */
background-color: rgba(128, 216, 255, 0.33);
}
.ORANGE_HIGHLIGHT {
/* blue A100 */
background-color: rgba(255, 165, 0, 0.33);
}
.PURPLE_HIGHLIGHT {
/* blue A100 */
background-color: rgba(128, 0, 128, 0.33);
}
.UNDERLINE {
text-decoration: underline;
}

.YELLOW_STAR>.bookmark1:after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ import android.graphics.Color
*/
enum class BookmarkStyle(val backgroundColor: Int) {
YELLOW_STAR(Color.argb(0, 255, 255, 255)),
RED_HIGHLIGHT(Color.argb((255 * 0.28).toInt(), 213, 0, 0)),
YELLOW_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 255, 255, 0)),
GREEN_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 0, 255, 0)),
BLUE_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 145, 167, 255)),
// Special hard-coded style for Speak bookmarks. This must be last one here.
RED_HIGHLIGHT(Color.argb((255 * 0.28).toInt(), 213, 0, 0)),
YELLOW_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 255, 255, 0)),
GREEN_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 0, 255, 0)),
BLUE_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 145, 167, 255)),
ORANGE_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 255, 165, 0)),
PURPLE_HIGHLIGHT(Color.argb((255 * 0.33).toInt(), 128, 0, 128)),
UNDERLINE(0),

// Special hard-coded style for Speak bookmarks. This must be last one here.
// This is removed from the style lists.
SPEAK(Color.argb(0, 255, 255, 255));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.content.Context
import android.graphics.Color
import android.text.SpannableString
import android.text.style.ImageSpan
import android.text.style.UnderlineSpan
import android.view.Gravity
import android.widget.TextView
import net.bible.android.activity.R
Expand Down Expand Up @@ -94,6 +95,19 @@ class BookmarkStyleAdapterHelper {
backgroundColor = BookmarkStyle.BLUE_HIGHLIGHT.backgroundColor
view.text = baseText
}
BookmarkStyle.ORANGE_HIGHLIGHT -> {
backgroundColor = BookmarkStyle.ORANGE_HIGHLIGHT.backgroundColor
view.text = baseText
}
BookmarkStyle.PURPLE_HIGHLIGHT -> {
backgroundColor = BookmarkStyle.PURPLE_HIGHLIGHT.backgroundColor
view.text = baseText
}
BookmarkStyle.UNDERLINE -> {
var text = SpannableString(baseText)
text.setSpan(UnderlineSpan(), 0, text.length, 0)
view.setText(text)
}
}
view.setBackgroundColor(backgroundColor)
view.height = convertDipsToPx(30)
Expand Down

0 comments on commit e822b1c

Please sign in to comment.