From 003170e6d8648f930721f4b8cde54ea72f08fc17 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 22 Sep 2019 13:26:53 +0200 Subject: [PATCH] add tab description and download dialog bag button --- .../org/schabi/newpipe/download/DownloadDialog.java | 1 + .../org/schabi/newpipe/fragments/MainFragment.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index f77daa092..9f9dce259 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -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 diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java index 5c5fd8635..7aeafb4a2 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -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())); }