1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-25 01:20:34 +00:00

Merge pull request #2655 from TeamNewPipe/accessebility

Improve Accessebility for blind people
This commit is contained in:
Tobias Groza 2019-10-01 21:25:21 +02:00 committed by GitHub
commit b4b24a4f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 7 deletions

View File

@ -73,6 +73,7 @@ public class MainActivity extends AppCompatActivity {
private DrawerLayout drawer = null;
private NavigationView drawerItems = null;
private TextView headerServiceView = null;
private Button toggleServiceButton = null;
private boolean servicesShown = false;
private ImageView serviceArrow;
@ -266,8 +267,8 @@ public class MainActivity extends AppCompatActivity {
serviceArrow = hView.findViewById(R.id.drawer_arrow);
headerServiceView = hView.findViewById(R.id.drawer_header_service_view);
Button action = hView.findViewById(R.id.drawer_header_action_button);
action.setOnClickListener(view -> {
toggleServiceButton = hView.findViewById(R.id.drawer_header_action_button);
toggleServiceButton.setOnClickListener(view -> {
toggleServices();
});
}
@ -279,6 +280,7 @@ public class MainActivity extends AppCompatActivity {
drawerItems.getMenu().removeGroup(R.id.menu_tabs_group);
drawerItems.getMenu().removeGroup(R.id.menu_options_about_group);
if(servicesShown) {
showServices();
} else {
@ -364,6 +366,8 @@ public class MainActivity extends AppCompatActivity {
String selectedServiceName = NewPipe.getService(
ServiceHelper.getSelectedServiceId(this)).getServiceInfo().getName();
headerServiceView.setText(selectedServiceName);
toggleServiceButton.setContentDescription(
getString(R.string.drawer_header_description) + selectedServiceName);
} catch (Exception e) {
ErrorActivity.reportUiError(this, e);
}
@ -557,6 +561,14 @@ public class MainActivity extends AppCompatActivity {
}
}
private void updateDrawerHeaderString(String content) {
NavigationView navigationView = findViewById(R.id.navigation);
View hView = navigationView.getHeaderView(0);
Button action = hView.findViewById(R.id.drawer_header_action_button);
action.setContentDescription(content);
}
private void handleIntent(Intent intent) {
try {
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]");

View File

@ -359,6 +359,7 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
toolbar.setNavigationIcon(isLight ? R.drawable.ic_arrow_back_black_24dp : R.drawable.ic_arrow_back_white_24dp);
toolbar.inflateMenu(R.menu.dialog_url);
toolbar.setNavigationOnClickListener(v -> getDialog().dismiss());
toolbar.setNavigationContentDescription(R.string.cancel);
okButton = toolbar.findViewById(R.id.okay);
okButton.setEnabled(false);// disable until the download service connection is done

View File

@ -159,6 +159,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
viewPager.setOffscreenPageLimit(pagerAdapter.getCount());
updateTabsIcon();
updateTabsContentDescription();
updateCurrentTitle();
}
@ -171,6 +172,17 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
}
}
private void updateTabsContentDescription() {
for (int i = 0; i < tabsList.size(); i++) {
final TabLayout.Tab tabToSet = tabLayout.getTabAt(i);
if (tabToSet != null) {
final Tab t = tabsList.get(i);
tabToSet.setIcon(t.getTabIconRes(activity));
tabToSet.setContentDescription(t.getTabName(activity));
}
}
}
private void updateCurrentTitle() {
setTitle(tabsList.get(viewPager.getCurrentItem()).getTabName(requireContext()));
}

View File

@ -9,6 +9,7 @@
android:id="@+id/drawer_header_action_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/drawer_header_description"
android:background="?android:attr/selectableItemBackground" />
<ImageView

View File

@ -32,7 +32,7 @@
<string name="settings_category_video_audio_title">Video &amp; Audio</string>
<string name="content_language_title">Bevorzugte Sprache des Inhalts</string>
<string name="list_thumbnail_view_description">Video-Vorschaubild</string>
<string name="detail_thumbnail_view_description">Video-Vorschaubild</string>
<string name="detail_thumbnail_view_description">Video abspielen, dauer</string>
<string name="detail_uploader_thumbnail_view_description">Nutzerbild</string>
<string name="detail_dislikes_img_view_description">Gefällt nicht</string>
<string name="detail_likes_img_view_description">Gefällt</string>

View File

@ -228,7 +228,7 @@
<string name="error_details_headline">Details:</string>
<!-- Content descriptions (for better accessibility) -->
<string name="list_thumbnail_view_description">Video preview thumbnail</string>
<string name="detail_thumbnail_view_description">Video preview thumbnail</string>
<string name="detail_thumbnail_view_description">Play video, duration:</string>
<string name="detail_uploader_thumbnail_view_description">Uploader\'s avatar thumbnail</string>
<string name="detail_likes_img_view_description">Likes</string>
<string name="detail_dislikes_img_view_description">Dislikes</string>
@ -250,6 +250,7 @@
<string name="short_thousand">K</string>
<string name="short_million">M</string>
<string name="short_billion">B</string>
<string name="drawer_header_description">Toggle service, currently selected:</string>
<!--Zero don't get selected (in some languages) as it is not a "special case" for android-->
<string name="no_subscribers">No subscribers</string>
<plurals name="subscribers">

View File

@ -1,8 +1,6 @@
#Fri Mar 30 10:42:05 CEST 2018
#Sun Sep 22 10:40:45 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb
#distributionSha256Sum must be updated along with the version of gradle in distributionUrl