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

Add option to hide thumbnail on lock screen #4642

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

XiangRongLin
Copy link
Collaborator

@XiangRongLin XiangRongLin commented Oct 25, 2020

What is it?

  • Feature (user facing)

Description of the changes in your PR

  • Readd option to not show thumbnail on the lock screen
  • Setting is located under appearance

Fixes the following issue(s)

APK testing

app-debug.zip

Due diligence

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I'm not sure if Appearance is the correct place for this setting. I'd put it into Notification, since at the end of the day the lockscreen thumbnail is strictly related to the notification. Or maybe let's rename Notification to Media or something else (which would also solve the naming clash with #2335). What's your opinion on this? @opusforlife2 @TobiGr

@@ -34,4 +34,10 @@
android:title="@string/caption_setting_title"
app:iconSpaceReserved="false" />

<SwitchPreferenceCompat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switch should be hidden on API <21, since the lockscreen thumbnail was not a feature until Android Lollipop

Copy link
Collaborator Author

@XiangRongLin XiangRongLin Oct 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a preference for doing this with xml only or programmatically hiding it with java code.

Edit: preference as in which type is more liked. not as in a setting. I see how this could be misunderstood.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to do this programmatically by getting the preference object in the settings fragment for appearance and hiding it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XML only is also possible, hence my question
You have values/bool.xml with a value being false and values-v22/bool.xml with the same value being true. In the preference xml you then add app:isPreferenceVisible="@bool/{key}"
Same could be done for app:visibility, with the values being strings for gone, invisible and visible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like obfuscation: even though it works, it's more of a workaround than a real solution. I'd use normal code like it's done in all other PreferenceFragments

@opusforlife2
Copy link
Collaborator

I'd put it into Notification, since at the end of the day the lockscreen thumbnail is strictly related to the notification.

Let's do this for now, @Stypox.

@XiangRongLin
Copy link
Collaborator Author

I'll adjust the PR when #4652 gets merged

@Stypox
Copy link
Member

Stypox commented Oct 26, 2020

Reminder for future me: before merging this we should make sure it also fixes #4651

@XiangRongLin
Copy link
Collaborator Author

XiangRongLin commented Nov 1, 2020

I rebased it on top of my other PR to avoid merge conflicts, so ignore this for now until that one is merged.
I also get a crash in an API 19 emulator when i open the notification settings. I currently don't want to figure it out, since debugging that is a pain with my potato of a laptop. I can try to figure it out in ~1Week, when i get my new PC (and don't mess up building it).

Edit: DHL sucks and im missing my pc case

@XiangRongLin XiangRongLin marked this pull request as draft November 1, 2020 18:35
@XiangRongLin
Copy link
Collaborator Author

New Pc, the crash doesn't occur anymore.

I didn't disable the setting in old android versions since the option now also hides the image inside the notification, whichs works on old version.

@XiangRongLin XiangRongLin marked this pull request as ready for review November 14, 2020 09:03
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on Android 11 and 4.4 and everything works good. Thank you! :-D

@Stypox Stypox merged commit 06b7072 into TeamNewPipe:dev Nov 20, 2020
@XiangRongLin XiangRongLin deleted the hide_thumbnail branch November 20, 2020 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants