From cc72fa4793dfc357c53da7108fd9c386e9839be9 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Mon, 29 Mar 2021 19:05:57 -0400 Subject: [PATCH 1/3] Renamed things pertaining to the about package --- .../schabi/newpipe/about/AboutActivity.java | 22 +++++++++---------- .../schabi/newpipe/about/LicenseFragment.java | 8 +++---- app/src/main/res/layout/activity_about.xml | 8 +++---- app/src/main/res/layout/fragment_about.xml | 19 +++++----------- app/src/main/res/layout/fragment_licenses.xml | 6 ++--- app/src/main/res/menu/software_component.xml | 6 ++--- 6 files changed, 29 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java index ec28be237..6db464f64 100644 --- a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java +++ b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java @@ -85,16 +85,16 @@ public class AboutActivity extends AppCompatActivity { final ActivityAboutBinding aboutBinding = ActivityAboutBinding.inflate(getLayoutInflater()); setContentView(aboutBinding.getRoot()); - setSupportActionBar(aboutBinding.toolbar); + setSupportActionBar(aboutBinding.aboutToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. - final SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(this); + final AboutStateAdapter mAboutStateAdapter = new AboutStateAdapter(this); // Set up the ViewPager with the sections adapter. - aboutBinding.container.setAdapter(mSectionsPagerAdapter); + aboutBinding.aboutViewPager2.setAdapter(mAboutStateAdapter); - new TabLayoutMediator(aboutBinding.tabs, aboutBinding.container, (tab, position) -> { + new TabLayoutMediator(aboutBinding.aboutTabLayout, aboutBinding.aboutViewPager2, (tab, position) -> { switch (position) { default: case POS_ABOUT: @@ -143,18 +143,18 @@ public class AboutActivity extends AppCompatActivity { FragmentAboutBinding.inflate(inflater, container, false); final Context context = getContext(); - aboutBinding.appVersion.setText(BuildConfig.VERSION_NAME); + aboutBinding.aboutAppVersion.setText(BuildConfig.VERSION_NAME); - aboutBinding.githubLink.setOnClickListener(nv -> + aboutBinding.aboutGithubLink.setOnClickListener(nv -> openUrlInBrowser(context, context.getString(R.string.github_url), false)); - aboutBinding.donationLink.setOnClickListener(v -> + aboutBinding.aboutDonationLink.setOnClickListener(v -> openUrlInBrowser(context, context.getString(R.string.donation_url), false)); - aboutBinding.websiteLink.setOnClickListener(nv -> + aboutBinding.aboutWebsiteLink.setOnClickListener(nv -> openUrlInBrowser(context, context.getString(R.string.website_url), false)); - aboutBinding.privacyPolicyLink.setOnClickListener(v -> + aboutBinding.aboutPrivacyPolicyLink.setOnClickListener(v -> openUrlInBrowser(context, context.getString(R.string.privacy_policy_url), false)); @@ -166,8 +166,8 @@ public class AboutActivity extends AppCompatActivity { * A {@link FragmentStateAdapter} that returns a fragment corresponding to * one of the sections/tabs/pages. */ - public static class SectionsPagerAdapter extends FragmentStateAdapter { - public SectionsPagerAdapter(final FragmentActivity fa) { + private static class AboutStateAdapter extends FragmentStateAdapter { + AboutStateAdapter(final FragmentActivity fa) { super(fa); } diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java index f5bf4df19..822161806 100644 --- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java +++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java @@ -74,7 +74,7 @@ public class LicenseFragment extends Fragment { final FragmentLicensesBinding binding = FragmentLicensesBinding .inflate(inflater, container, false); - binding.appReadLicense.setOnClickListener(v -> { + binding.licensesAppReadLicense.setOnClickListener(v -> { activeLicense = StandardLicenses.GPL3; compositeDisposable.add(LicenseFragmentHelper.showLicense(getActivity(), StandardLicenses.GPL3)); @@ -96,7 +96,7 @@ public class LicenseFragment extends Fragment { compositeDisposable.add(LicenseFragmentHelper.showLicense(getActivity(), component.getLicense())); }); - binding.softwareComponents.addView(root); + binding.licensesSoftwareComponents.addView(root); registerForContextMenu(root); } if (activeLicense != null) { @@ -125,10 +125,10 @@ public class LicenseFragment extends Fragment { return false; } switch (item.getItemId()) { - case R.id.action_website: + case R.id.menu_software_website: ShareUtils.openUrlInBrowser(getActivity(), component.getLink()); return true; - case R.id.action_show_license: + case R.id.menu_software_show_license: compositeDisposable.add(LicenseFragmentHelper.showLicense(getActivity(), component.getLicense())); } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 525b2371f..937fcf977 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -2,14 +2,12 @@ diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 77f940685..3211f3bd9 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -15,16 +15,14 @@ android:paddingBottom="@dimen/activity_vertical_margin">