Skip to content

Commit

Permalink
added accessibility text on settings page (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco authored Nov 23, 2022
1 parent f65fac7 commit 1ccd314
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class SettingsActivity : AppCompatActivity() {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setHomeActionContentDescription(getString(R.string.accessibility_text_close))
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close)
toolbar.setNavigationOnClickListener { onBackPressed() }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SettingsFragment : PreferenceFragmentCompat() {

val acc = SessionManager.requireSession.account
preferenceScreen.findPreference<AccountPreference>(resources.getString(R.string.pref_account_key))?.apply {
accessibilityTextUserInfo = getString(R.string.accessibility_text_user_info, acc.displayName, acc.email)
title = acc.displayName
summary = acc.email
loadAny(PeopleRepository.myPicture()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.alfresco.content.app.widget
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import com.alfresco.content.app.R
Expand All @@ -11,11 +12,15 @@ import com.google.android.material.button.MaterialButton
class AccountPreference(context: Context, attrs: AttributeSet?) : Preference(context, attrs) {

private lateinit var signOutButton: MaterialButton
private lateinit var parentUserInfo: LinearLayout
var onSignOutClickListener: View.OnClickListener? = null
var accessibilityTextUserInfo = ""

override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
signOutButton = holder.findViewById(R.id.sign_out_button) as MaterialButton
parentUserInfo = holder.findViewById(R.id.parent_user_info) as LinearLayout
parentUserInfo.contentDescription = accessibilityTextUserInfo
signOutButton.setOnClickListener(onSignOutClickListener)
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/layout/layout_pref_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
android:orientation="vertical">

<LinearLayout
android:id="@+id/parent_user_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:clipToPadding="false"
android:screenReaderFocusable="true"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<string name="share_limit_message">Can\'t share more than 50 media items</string>
<string name="no_type">No Type</string>
<string name="accessibility_text_user_profile">User Profile Button</string>
<string name="accessibility_text_user_info">Username: %s Email: %s</string>
<string name="accessibility_text_close">Close</string>

<string-array name="settings_sync_network_value_labels">
<item>Wi-Fi only</item>
Expand Down

0 comments on commit 1ccd314

Please sign in to comment.