Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and shrink resources #1603

Open
TobiGr opened this issue Aug 14, 2018 · 6 comments
Open

Improve and shrink resources #1603

TobiGr opened this issue Aug 14, 2018 · 6 comments
Labels
discussion This needs to be discussed before anything is done feature request Issue is related to a feature in the app

Comments

@TobiGr
Copy link
Contributor

TobiGr commented Aug 14, 2018

I took a look at the resources and I think that there is potential to minimize NewPipe's size further.

1. Remove duplicate resource strings

In main/res/values/strings.xml you will find several identical strings/values with different names:

  • Play: play_btn_text, view
  • Video preview thumbnail: list_thumbnail_view_description, detail_thumbnail_view_description
  • Popup: controls_popup_title, settings_category_popup_title
  • Error: general_error, msg_error
  • Downloads: downloads, downloads_title
  • Audio: play_audio, audio
  • History: title_activity_history, action_history
  • NewPipe: app_name, preferred_open_action_share_menu_title
  • Download: download, download_dialog_title, settings_category_downloads_title
  • Settings: settings, action_settings
  • About: action_about, tab_about

By removing at least one duplicate occurrence, we'd not only reduce the effort it needs to translate all parts of the app but also the APK size. In some cases it makes sense to not remove the whole string and its value, but replace the value with a reference to another string:

<string name="downloads_title">Downloads</string>
=>
<string name="downloads_title" translatable="false">@string/downloads</string>

2. Remove unused strings

There are several unused strings which we should consider to remove. Unfortunately, Android Studio didn't do a good job while searching for unused resources and removed various required strings. For this reason, I wrote a small programme which is more reliable in finding unused strings. Nevertheless we should discuss what to do with strings which are likely to be used in the future. (e.g everything about TOR).

3. Optimize drawables

Our images need quite much memory. We should use vector graphics instead of PNGs (see #1199 for more info). There were some attempts to do this, but they got rejected. Until this is done, we can minimize the images manually or via ImgBot.


But before I dig a bit deeper in the optimization, I'd like to hear the common opinion on this. @theScrabi @wb9688 @mauriciocolli @karyogamy

@theScrabi
Copy link
Member

theScrabi commented Aug 19, 2018

Go for it. But remember that we should make our png files compatible with fdroid reproducable build.

@TobiGr
Copy link
Contributor Author

TobiGr commented Aug 19, 2018

But remember that we should make our png files compatible with fdroid reproducable build.

Did you have problems with PNG files?

F-Droid's docs say, thee shouldn't be a problem:

An awful lot of builds already verify with no extra effort since Java code is often compiled into the same bytecode by a wide range of Java versions. The Android SDK’s build-tools will create differences in the resulting XML, PNG, etc. files, but this is usually not a problem since the build.gradle includes the exact version of build-tools to use.

@theScrabi
Copy link
Member

ok

@TheMatten TheMatten mentioned this issue Aug 22, 2018
1 task
@TobiGr TobiGr mentioned this issue Aug 23, 2018
1 task
@ghost
Copy link

ghost commented Aug 25, 2018

@TobiGr I took a look at the project with Android Studio.
it provides some more possibility's to improve the code and minimize NewPipe's size further.

I opened 2 PR's (#1625, TeamNewPipe/NewPipeExtractor#100).
But there is even more to improve, according to Android Studio (see included screenshots in each PR). But some changes require a good understanding of the code and some effort.

maybe someone of you will check it out :)

@stale
Copy link

stale bot commented Dec 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 1, 2018
@TobiGr TobiGr removed the stale label Jul 19, 2019
@Stypox Stypox added discussion This needs to be discussed before anything is done feature request Issue is related to a feature in the app labels Aug 27, 2019
@triallax triallax mentioned this issue Oct 23, 2020
5 tasks
@triallax
Copy link
Contributor

I'm trying to solve section 1, but I have a question regarding this statement:

In some cases it makes sense to not remove the whole string and its value, but replace the value with a reference to another string

Can anybody clarify what would those cases be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This needs to be discussed before anything is done feature request Issue is related to a feature in the app
Projects
None yet
Development

No branches or pull requests

4 participants