Skip to content

Commit

Permalink
Add off-screen hot buffer indicators in buffer list
Browse files Browse the repository at this point in the history
Indicators are located at the top and the bottom of the buffer list,
touching window insents, if any. They are shown if there's a hot buffer
above or below the visible buffers, including buffers that are partially
visible. When pressed, they cause the buffer list to scroll to the next hot
buffer in the direction of the button, trying to center the buffer.

The indicators are image buttons with background that is transparent while
the button is not pressed. Both the image and the background are rounded
rectangles. The image is a combination of the badge that we use showing the
number of highlights for a buffer in the buffer list, and the double arrow
that we use for jumping to bottom in the chat.
  • Loading branch information
oakkitten committed Dec 7, 2024
1 parent 677aabc commit d54bfc4
Show file tree
Hide file tree
Showing 11 changed files with 408 additions and 14 deletions.
131 changes: 131 additions & 0 deletions app/src/main/inkscape/ic_bufferlist_arrow_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 133 additions & 0 deletions app/src/main/inkscape/ic_bufferlist_arrow_up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/inkscape/optimized/ic_bufferlist_arrow_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/inkscape/optimized/ic_bufferlist_arrow_up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.ubergeek42.WeechatAndroid.R
import com.ubergeek42.WeechatAndroid.adapters.BufferListAdapter.*
import com.ubergeek42.WeechatAndroid.adapters.BufferListAdapter.VisualBuffer
import com.ubergeek42.WeechatAndroid.databinding.BufferlistItemBinding
import com.ubergeek42.WeechatAndroid.relay.Buffer
import com.ubergeek42.WeechatAndroid.relay.BufferList
Expand All @@ -35,7 +35,7 @@ import com.ubergeek42.WeechatAndroid.upload.main
import com.ubergeek42.WeechatAndroid.utils.Utils
import com.ubergeek42.cats.Kitty
import com.ubergeek42.cats.Root
import java.util.*
import java.util.Collections


class BufferListAdapter(
Expand Down Expand Up @@ -206,6 +206,14 @@ class BufferListAdapter(
}
}

//////////////////////////////////////////////////////////////////////////////////////////// Etc

@MainThread fun findNextHotBufferPositionOrNull(positionsToSearch: IntProgression) =
positionsToSearch.firstOrNull { position ->
val buffer = buffers.getOrElse(position) { return@firstOrNull false }
buffer.highlights > 0 || (buffer.type == BufferSpec.Type.Private && buffer.unreads != 0)
}

companion object {
@Root private val kitty: Kitty = Kitty.make()

Expand Down
Loading

0 comments on commit d54bfc4

Please sign in to comment.