Skip to content
Snippets Groups Projects
Verified Commit 82216cfa authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Improve accessibility

parent 21bf8491
No related branches found
No related tags found
No related merge requests found
Pipeline #355 canceled
Showing
with 72 additions and 13 deletions
......@@ -494,13 +494,15 @@ class BufferViewConfigFragment : ServiceBoundFragment() {
.mapMap(BufferViewConfig::showSearch)
.mapOrElse(false)
combineLatest(viewModel.bufferSearchTemporarilyVisible, bufferSearchPermanentlyVisible)
combineLatest(viewModel.bufferSearchTemporarilyVisible.distinctUntilChanged(),
bufferSearchPermanentlyVisible)
.toLiveData().observe(this, Observer { (temporarily, permanently) ->
val visible = temporarily || permanently
val menuItem = chatListToolbar.menu.findItem(R.id.action_search)
menuItem.isVisible = !permanently
if (permanently) menuItem.isChecked = false
else menuItem.isChecked = temporarily
bufferSearchContainer.visibleIf(visible)
if (!visible) bufferSearch.setText("")
......@@ -516,6 +518,8 @@ class BufferViewConfigFragment : ServiceBoundFragment() {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) = Unit
})
bufferSearchClear.setTooltip()
bufferSearchClear.setOnClickListener {
bufferSearch.setText("")
}
......
......@@ -157,6 +157,7 @@ class ChatlineFragment : ServiceBoundFragment() {
editorHelper.replaceText(text)
historyBottomSheet.state = BottomSheetBehavior.STATE_HIDDEN
}
close.setTooltip()
close.setOnClickListener {
historyBottomSheet.state = BottomSheetBehavior.STATE_HIDDEN
}
......@@ -204,6 +205,7 @@ class ChatlineFragment : ServiceBoundFragment() {
send.setOnClickListener { send() }
send.setTooltip()
tabComplete.setTooltip()
tabComplete.visibleIf(autoCompleteSettings.button)
tabComplete.setOnClickListener {
autoCompleteHelper.autoComplete()
......
......@@ -26,12 +26,12 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.malheur.data.Report
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.lists.ListAdapter
import org.threeten.bp.Instant
import org.threeten.bp.ZoneId
import org.threeten.bp.format.DateTimeFormatter
......@@ -45,6 +45,15 @@ class CrashAdapter : ListAdapter<Pair<Report, Uri>, CrashAdapter.CrashViewHolder
oldItem == newItem
}
) {
private var onUpdateListener: ((List<Pair<Report, Uri>>) -> Unit)? = null
fun setOnUpdateListener(listener: ((List<Pair<Report, Uri>>) -> Unit)?) {
onUpdateListener = listener
}
override fun onUpdateFinished(list: List<Pair<Report, Uri>>) {
onUpdateListener?.invoke(list)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CrashViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.widget_crash, parent, false)
)
......
......@@ -24,6 +24,7 @@ import android.os.Bundle
import android.os.Handler
import android.os.HandlerThread
import android.view.*
import android.widget.TextView
import androidx.core.content.FileProvider
import androidx.core.view.ViewCompat
import androidx.recyclerview.widget.DividerItemDecoration
......@@ -37,6 +38,7 @@ import de.kuschku.malheur.data.Report
import de.kuschku.quasseldroid.BuildConfig
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.helper.fromJson
import de.kuschku.quasseldroid.util.helper.visibleIf
import java.io.File
import javax.inject.Inject
......@@ -44,6 +46,9 @@ class CrashFragment : DaggerFragment() {
@BindView(R.id.list)
lateinit var list: RecyclerView
@BindView(R.id.crashes_empty)
lateinit var crashesEmpty: TextView
private lateinit var handlerThread: HandlerThread
private lateinit var handler: Handler
......@@ -80,6 +85,10 @@ class CrashFragment : DaggerFragment() {
list.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
ViewCompat.setNestedScrollingEnabled(list, false)
adapter?.setOnUpdateListener {
crashesEmpty.visibleIf(it.isEmpty())
}
handler.post {
val crashDir = this.crashDir
val gson = this.gson
......
......@@ -29,6 +29,7 @@ import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.persistence.QuasselDatabase
import de.kuschku.quasseldroid.util.helper.setTooltip
import de.kuschku.quasseldroid.util.helper.visibleIf
class WhitelistCertificateAdapter :
......@@ -114,6 +115,7 @@ class WhitelistCertificateAdapter :
clickListener?.invoke(it)
}
}
delete.setTooltip()
}
fun bind(item: QuasselDatabase.SslValidityWhitelistEntry) {
......
......@@ -29,6 +29,7 @@ import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.persistence.QuasselDatabase
import de.kuschku.quasseldroid.util.helper.setTooltip
class WhitelistHostnameAdapter :
RecyclerView.Adapter<WhitelistHostnameAdapter.WhitelistItemViewHolder>() {
......@@ -108,6 +109,7 @@ class WhitelistHostnameAdapter :
clickListener?.invoke(it)
}
}
delete.setTooltip()
}
fun bind(item: QuasselDatabase.SslHostnameWhitelistEntry) {
......
......@@ -32,8 +32,7 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/chatListToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
app:contentInsetLeft="0dip"
app:contentInsetStart="0dip"
app:contentInsetStartWithNavigation="0dip"
......@@ -60,9 +59,9 @@
android:id="@+id/buffer_search_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
app:cardBackgroundColor="?colorBackgroundSearch"
app:cardElevation="2dp"
android:layout_margin="6dp">
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
......@@ -77,8 +76,8 @@
android:background="@android:color/transparent"
android:hint="@string/label_search_buffer"
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
android:importantForAutofill="no"
android:inputType="textNoSuggestions"
android:lines="1"
android:minHeight="40dp"
android:paddingLeft="8dp"
......@@ -92,6 +91,7 @@
android:layout_width="40dp"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/label_clear_search"
app:srcCompat="@drawable/ic_close"
app:tint="?colorTextSearchSecondary" />
......
......@@ -46,6 +46,7 @@
android:padding="12dp"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_tab"
app:tint="?attr/colorTextSecondary" />
......@@ -90,6 +91,7 @@
android:padding="12dp"
android:scaleType="fitXY"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_send"
app:tint="?attr/colorAccent"
tools:ignore="UnusedAttribute" />
......
......@@ -70,6 +70,7 @@
android:layout_height="48dp"
android:layout_gravity="top|end"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/label_close"
android:padding="12dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_chevron_down"
......
......@@ -17,10 +17,32 @@
with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
tools:listitem="@layout/widget_crash" />
<TextView
android:id="@+id/crashes_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingStart="?listPreferredItemPaddingLeft"
android:paddingLeft="?listPreferredItemPaddingLeft"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingRight="?listPreferredItemPaddingRight"
android:text="@string/label_crashes_empty"
android:textColor="?colorTextSecondary"
android:textStyle="italic"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
......@@ -66,6 +66,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/label_delete"
android:paddingStart="32dp"
android:paddingLeft="32dp"
android:paddingEnd="?listPreferredItemPaddingRight"
......
......@@ -66,6 +66,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/label_delete"
android:paddingStart="32dp"
android:paddingLeft="32dp"
android:paddingEnd="?listPreferredItemPaddingRight"
......
......@@ -84,6 +84,7 @@
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/label_edit_core"
android:tint="#757575"
app:srcCompat="@drawable/ic_pencil" />
</LinearLayout>
......@@ -36,6 +36,7 @@
<string name="label_cancel">Cancel</string>
<string name="label_update_user_password">Update User/Password</string>
<string name="label_certificates">Certificates</string>
<string name="label_clear_search">Clear Search</string>
<string name="label_close">Close</string>
<string name="label_colors_custom">Custom</string>
<string name="label_colors_mirc">mIRC</string>
......@@ -44,12 +45,14 @@
<string name="label_contributors">Contributors</string>
<string name="label_copy">Copy</string>
<string name="label_crashes">Crashes</string>
<string name="label_crashes_empty">No crash reports found</string>
<string name="label_shortcut">Shortcut</string>
<string name="label_shortcut_long">Create Shortcut on Homescreen</string>
<string name="label_delete">Delete</string>
<string name="label_delete_all">Delete All</string>
<string name="label_disconnect">Disconnect</string>
<string name="label_edit_nick">Edit nickname</string>
<string name="label_edit_core">Edit Account</string>
<string name="label_edit_nick">Edit Nickname</string>
<string name="label_edit_topic">Edit Topic</string>
<string name="label_edit_topic_long">Open dialog to change the channel topic</string>
<string name="label_filter_messages">Filter Messages</string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment