Merge remote-tracking branch 'upstream/dev' into videoDetailscrollFix

This commit is contained in:
yausername 2019-10-02 06:35:44 +05:30
commit cf6380b3c7
9 changed files with 39 additions and 8 deletions

View File

@ -69,6 +69,10 @@ dependencies {
implementation "com.android.support:cardview-v7:${supportLibVersion}" implementation "com.android.support:cardview-v7:${supportLibVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// Originally in NewPipeExtractor
implementation 'com.grack:nanojson:1.1'
implementation 'org.jsoup:jsoup:1.9.2'
implementation 'ch.acra:acra:4.9.2' //4.11 implementation 'ch.acra:acra:4.9.2' //4.11
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

View File

@ -73,6 +73,7 @@ public class MainActivity extends AppCompatActivity {
private DrawerLayout drawer = null; private DrawerLayout drawer = null;
private NavigationView drawerItems = null; private NavigationView drawerItems = null;
private TextView headerServiceView = null; private TextView headerServiceView = null;
private Button toggleServiceButton = null;
private boolean servicesShown = false; private boolean servicesShown = false;
private ImageView serviceArrow; private ImageView serviceArrow;
@ -266,8 +267,8 @@ public class MainActivity extends AppCompatActivity {
serviceArrow = hView.findViewById(R.id.drawer_arrow); serviceArrow = hView.findViewById(R.id.drawer_arrow);
headerServiceView = hView.findViewById(R.id.drawer_header_service_view); headerServiceView = hView.findViewById(R.id.drawer_header_service_view);
Button action = hView.findViewById(R.id.drawer_header_action_button); toggleServiceButton = hView.findViewById(R.id.drawer_header_action_button);
action.setOnClickListener(view -> { toggleServiceButton.setOnClickListener(view -> {
toggleServices(); toggleServices();
}); });
} }
@ -279,6 +280,7 @@ public class MainActivity extends AppCompatActivity {
drawerItems.getMenu().removeGroup(R.id.menu_tabs_group); drawerItems.getMenu().removeGroup(R.id.menu_tabs_group);
drawerItems.getMenu().removeGroup(R.id.menu_options_about_group); drawerItems.getMenu().removeGroup(R.id.menu_options_about_group);
if(servicesShown) { if(servicesShown) {
showServices(); showServices();
} else { } else {
@ -364,6 +366,8 @@ public class MainActivity extends AppCompatActivity {
String selectedServiceName = NewPipe.getService( String selectedServiceName = NewPipe.getService(
ServiceHelper.getSelectedServiceId(this)).getServiceInfo().getName(); ServiceHelper.getSelectedServiceId(this)).getServiceInfo().getName();
headerServiceView.setText(selectedServiceName); headerServiceView.setText(selectedServiceName);
toggleServiceButton.setContentDescription(
getString(R.string.drawer_header_description) + selectedServiceName);
} catch (Exception e) { } catch (Exception e) {
ErrorActivity.reportUiError(this, 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) { private void handleIntent(Intent intent) {
try { try {
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]"); 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.setNavigationIcon(isLight ? R.drawable.ic_arrow_back_black_24dp : R.drawable.ic_arrow_back_white_24dp);
toolbar.inflateMenu(R.menu.dialog_url); toolbar.inflateMenu(R.menu.dialog_url);
toolbar.setNavigationOnClickListener(v -> getDialog().dismiss()); toolbar.setNavigationOnClickListener(v -> getDialog().dismiss());
toolbar.setNavigationContentDescription(R.string.cancel);
okButton = toolbar.findViewById(R.id.okay); okButton = toolbar.findViewById(R.id.okay);
okButton.setEnabled(false);// disable until the download service connection is done 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()); viewPager.setOffscreenPageLimit(pagerAdapter.getCount());
updateTabsIcon(); updateTabsIcon();
updateTabsContentDescription();
updateCurrentTitle(); 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() { private void updateCurrentTitle() {
setTitle(tabsList.get(viewPager.getCurrentItem()).getTabName(requireContext())); setTitle(tabsList.get(viewPager.getCurrentItem()).getTabName(requireContext()));
} }

View File

@ -117,7 +117,9 @@ public class DownloadRunnable extends Thread {
byte[] buf = new byte[DownloadMission.BUFFER_SIZE]; byte[] buf = new byte[DownloadMission.BUFFER_SIZE];
int len; int len;
while (start < end && mMission.running && (len = is.read(buf, 0, buf.length)) != -1) { // use always start <= end
// fixes a deadlock in DownloadRunnable because youtube is sending one byte alone after downloading 26MiB exactly
while (start <= end && mMission.running && (len = is.read(buf, 0, buf.length)) != -1) {
f.write(buf, 0, len); f.write(buf, 0, len);
start += len; start += len;
block.done += len; block.done += len;

View File

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

View File

@ -32,7 +32,7 @@
<string name="settings_category_video_audio_title">Video &amp; Audio</string> <string name="settings_category_video_audio_title">Video &amp; Audio</string>
<string name="content_language_title">Bevorzugte Sprache des Inhalts</string> <string name="content_language_title">Bevorzugte Sprache des Inhalts</string>
<string name="list_thumbnail_view_description">Video-Vorschaubild</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_uploader_thumbnail_view_description">Nutzerbild</string>
<string name="detail_dislikes_img_view_description">Gefällt nicht</string> <string name="detail_dislikes_img_view_description">Gefällt nicht</string>
<string name="detail_likes_img_view_description">Gefällt</string> <string name="detail_likes_img_view_description">Gefällt</string>

View File

@ -228,7 +228,7 @@
<string name="error_details_headline">Details:</string> <string name="error_details_headline">Details:</string>
<!-- Content descriptions (for better accessibility) --> <!-- Content descriptions (for better accessibility) -->
<string name="list_thumbnail_view_description">Video preview thumbnail</string> <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_uploader_thumbnail_view_description">Uploader\'s avatar thumbnail</string>
<string name="detail_likes_img_view_description">Likes</string> <string name="detail_likes_img_view_description">Likes</string>
<string name="detail_dislikes_img_view_description">Dislikes</string> <string name="detail_dislikes_img_view_description">Dislikes</string>
@ -250,6 +250,7 @@
<string name="short_thousand">K</string> <string name="short_thousand">K</string>
<string name="short_million">M</string> <string name="short_million">M</string>
<string name="short_billion">B</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--> <!--Zero don't get selected (in some languages) as it is not a "special case" for android-->
<string name="no_subscribers">No subscribers</string> <string name="no_subscribers">No subscribers</string>
<plurals name="subscribers"> <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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 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