anonfaded / FadCam

Seamless background video recorder for Android – ad-free and open-source, with customizable options.
GNU General Public License v3.0
191 stars 14 forks source link

Change Hard-coded strings to string.xml and Add Chinese Simplified Translation #27

Closed WeiguangTWK closed 3 weeks ago

WeiguangTWK commented 1 month ago

Thank you for your nice app and I add Chinese Language into it

Also to enable it for translation, I made some modification to layout xmls and some java file so please carefully review it to so if these are OK

P.S. Changelog is left in English

here's some screenshot

1723639209626 1723639209619 1723639209614 1723639209604 1723639209599 1723639209594 1723639209589

WeiguangTWK commented 1 month ago

Note: Some removal of "import" code is automatically by IDE and not on purpose, review carefully

anonfaded commented 1 month ago

You did alot of work, I appreciate it, Thanks!

before merging, can you guide me to understand it better; how can a user change these translations? like there isnt any toggle button in settings right now from where users can choose translation(I think a toggle button will be better from where we can list the available translations and can save in shared preferences). And also for adding more translations in future, how can we do that, by editing which files?

WeiguangTWK commented 1 month ago

You did alot of work, I appreciate it, Thanks!

before merging, can you guide me to understand it better; how can a user change these translations? like there isnt any toggle button in settings right now from where users can choose translation(I think a toggle button will be better from where we can list the available translations and can save in shared preferences). And also for adding more translations in future, how can we do that, by editing which files?

Yeah a lot of works and actually I open this PR too early (Toast message is not yet done), there will be one more commit to finish translation

In fact FadCam is not prepared for i18n at the begining, all strings is hard-coded into source code. So what I have done is just replace them and made it to point to string.xml (default is at app\src\main\res\values)

How I introduce a new Language? in Android Studio, if gradle sync is done, inside Android Studio you can find string.xml at app/res/values/string.xml. Then open it with Android Studio and there will be a tip to tell you to open a Translations Editor. That's where I do my translation

In android, the toggle of Language change depends on the Language setting of the user, if display language of system is Chinese, then the app will switch to Chinese if strings in 'zh-rCN' is available

After Android 13 user actually can set certain app to display certain language, as far as I know another app translated by me support such function (not app supported but it just open a setting page offered by Android)

You can have a look: https://github.com/DP-Hridayan/aShellYou

WeiguangTWK commented 1 month ago

*There will be 1-2 commit(s) for toast message, I will comment when I done

anonfaded commented 1 month ago

Ok nice, but in future can we make such feature so this same translation will work with a toggle too instead of phone settings?

WeiguangTWK commented 1 month ago

The translation is alomst done and ready for merge

Ok nice, but in future can we make such feature so this same translation will work with a toggle too instead of phone settings?

not hard but you have to change your coding habit like avoid using hard coded strings like

.setMessage("Are you sure you want to delete this video?")

better way is to add a string called "dialog_del_notice" in string.xml and then

.setMessage(context.getString(R.string.dialog_del_notice))

It will be much easier for translators to do their job

WeiguangTWK commented 1 month ago

Oh by the way I have a feature request: notification

In China most of the Android System we use is heavily modified and behave differently about background apps, the last time I use FadCam I noticed that the video record failed because the system froze the FadCam and limit its access to camera from background ("Highly dangerous and privacy violating behaviour"). So you can enable user to send a notification when recording a video to keep background alive

Although it costs invisibility but still worth since that enhance the reliablity of FadCam

anonfaded commented 1 month ago

Yeah thanks for suggestions, btw I'm not an Android developer but still i managed to develop this so i added everything hardcoded for easiness. I just ignored the same msg in android studio at that time but from now on I'll do it the right way. :)

Thanks again for investing so much time in helping me out, thats a really great contribution!

Will merge the code in some time, and new release with credits will be in some hours.

anonfaded commented 1 month ago

Oh by the way I have a feature request: notification

In China most of the Android System we use is heavily modified and behave differently about background apps, the last time I use FadCam I noticed that the video record failed because the system froze the FadCam and limit its access to camera from background ("Highly dangerous and privacy violating behaviour"). So you can enable user to send a notification when recording a video to keep background alive

Although it costs invisibility but still worth since that enhance the reliablity of FadCam

Oh i received two more requests for this same issue. (see https://github.com/anonfaded/FadCam/discussions/20#discussioncomment-10327320) And I will try to find the root cause for this, i checked myself on samsung android 11 device and recorded for straight 45 minutes but it was all fine so right now i am not sure if the issue is with the latest android versions or the phone manufacturers are limiting the background feature. But you said you get this notification: Highly dangerous and privacy violating behaviour, so it seems like the issue is of app getting killed by the system. On Android 11 there already is a feature where we get the notification during recording, but on android 12 and above i dont see that notification, so i will see some workaround for this and if we make it to show a persistent notification then it may be fixed. I will let you know when its done so you can then test and give feedback before we make a release for this fix. Optionally you can join our discord or telegram group if interested.

anonfaded commented 1 month ago

Also you can open a bug issue for this or if not, i will do it myself.

WeiguangTWK commented 1 month ago

Also you can open a bug issue for this or if not, i will do it myself.

I will open a issue and make a detailed description tomorrow

WeiguangTWK commented 1 month ago

Also you can open a bug issue for this or if not, i will do it myself.

I find what the "broken" video actually is —— it is a watermark-failed video. It may caused by half way stop when FadCam is watermarking it

anonfaded commented 4 weeks ago

Also you can open a bug issue for this or if not, i will do it myself.

I find what the "broken" video actually is —— it is a watermark-failed video. It may caused by half way stop when FadCam is watermarking it

But for that i have designed it like if for some reason the app gets killed or stopped then the original video will still be there with a temp prefix. And if the watermarking is done till end then the temp video will be deleted and watermark one will be there with a FADCAM prefix. So wasn't there the temp video? It must be there as it don't delete if the returncode from the watermarking method isn't OK.

WeiguangTWK commented 4 weeks ago

But for that i have designed it like if for some reason the app gets killed or stopped then the original video will still be there with a temp prefix. And if the watermarking is done till end then the temp video will be deleted and watermark one will be there with a FADCAM prefix. So wasn't there the temp video? It must be there as it don't delete if the returncode from the watermarking method isn't OK.

Yes the "temp" one is kept so I think what I encounter is not a issue but a mis-kill actually. I will not open a bug issue

Maybe you can add a option in setting to allow user to get notified about the watermarking progress

anonfaded commented 4 weeks ago

Yes the "temp" one is kept so I think what I encounter is not a issue but a mis-kill actually. I will not open a bug issue

Maybe you can add a option in setting to allow user to get notified about the watermarking progress

Just to confirm, can you explain how actually the app stopped watermarking? Like you recorded with off screen? and for what duration? The temp video was there so it seems like the app's process was for sure killed by the system.

I will add new feature to show the remaining time or a notification to show during watermarking process so it can solve this issue i guess.

And the issue of notifications is still there so we have to fix these 2 issues, i will open issue for this.

WeiguangTWK commented 4 weeks ago

Just to confirm, can you explain how actually the app stopped watermarking? Like you recorded with off screen? and for what duration? The temp video was there so it seems like the app's process was for sure killed by the system.

I will add new feature to show the remaining time or a notification to show during watermarking process so it can solve this issue i guess.

And the issue of notifications is still there so we have to fix these 2 issues, i will open issue for this.

I record for abt 25min(background and screen off). The temp video is fine. I stopped recording and then exit FadCam using "back" nav button. Maybe no long after that FadCam got killed by system. Also I test for another several time finding this issue happens very randomly

WeiguangTWK commented 3 weeks ago

New translation added

have a look

Screenshot_2024-08-19-18-19-37-618_com fadcam-edit

anonfaded commented 3 weeks ago

I was busy in making my other project so this one got delayed, will merge soon.

I was working on a window app (https://github.com/anonfaded/FadCrypt)