Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

black theme not working #31

Closed
sirber opened this issue Sep 5, 2015 · 20 comments
Closed

black theme not working #31

sirber opened this issue Sep 5, 2015 · 20 comments

Comments

@sirber
Copy link

sirber commented Sep 5, 2015

with latest version on android 4.1.2. do you need more information?

@indywidualny
Copy link
Owner

Did it work before 1.8.0?

@sirber
Copy link
Author

sirber commented Sep 5, 2015

never did in fact :)

Stéphane Bérubé

Date: Sat, 5 Sep 2015 09:34:58 -0700
From: notifications@github.com
To: FaceSlim@noreply.github.com
CC: sirber@hotmail.com
Subject: Re: [FaceSlim] black theme not working (#31)

Did it work before 1.8.0?


Reply to this email directly or view it on GitHub.

@indywidualny
Copy link
Owner

It's something probably wrong in here - https://github.com/indywidualny/FaceSlim/blob/master/app/src/main/java/org/indywidualni/fblite/MyAppWebViewClient.java#L74

If someone could help me a little it would be great. I have no idea, everything is working for me.

@ghost
Copy link

ghost commented Sep 8, 2015

@indywidualny I've no idea how Android coding works. However I assume you scrape the CSS from m.facebook.com then change it. Could their CSS have changed?

@indywidualny
Copy link
Owner

It's possible they have changed something but not the whole of their style sheet. I'm using javascript to inject my own css after every page is loaded. It's read from a file and IMHO the problem is just reading file to string, in this particular case. However it's strange because black css is working on all my devices and nobody complained until now.

@sirber
Copy link
Author

sirber commented Sep 8, 2015

hi, it also doesn't work on my tablet (android 4.2.2). could it be related to lanfuage? i'm using the french translation.

Envoyé depuis un mobile Samsung

-------- Message d'origine --------
De : Krzysztof Grabowski notifications@github.com
Date : 09/08/2015 5:26 (GMT-05:00)
À : indywidualny/FaceSlim FaceSlim@noreply.github.com
Cc : "Stephane B." sirber@hotmail.com
Objet : Re: [FaceSlim] black theme not working (#31)

It's possible they have changed something but not the whole of their style sheet. I'm using javascript to inject my own css after every page is loaded. It's read from a file and IMHO the problem is just reading file to string, in this particular case. However it's strange because black css is working on all my devices and nobody complained until now.


Reply to this email directly or view it on GitHub.

@indywidualny
Copy link
Owner

Language is not a problem for sure.

wt., 8 wrz 2015, 12:17 Stephane B. użytkownik notifications@github.com
napisał:

hi, it also doesn't work on my tablet (android 4.2.2). could it be related
to lanfuage? i'm using the french translation.

Envoyé depuis un mobile Samsung

-------- Message d'origine --------
De : Krzysztof Grabowski notifications@github.com
Date : 09/08/2015 5:26 (GMT-05:00)
À : indywidualny/FaceSlim FaceSlim@noreply.github.com
Cc : "Stephane B." sirber@hotmail.com
Objet : Re: [FaceSlim] black theme not working (#31)

It's possible they have changed something but not the whole of their style
sheet. I'm using javascript to inject my own css after every page is
loaded. It's read from a file and IMHO the problem is just reading file to
string, in this particular case. However it's strange because black css is
working on all my devices and nobody complained until now.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#31 (comment)
.

@kamathln
Copy link

Karbonn Titanium Octane with Android 4.4.x , FaceSlim 1.8.0 from F-droid here. It just worked for me,

@sputtene
Copy link

sputtene commented Dec 1, 2015

Android 4.2.2 here, doesn't work either. I know how to code, so I can help you with testing/debugging if needed.

I haven't looked at the source code yet, so I don't know, but would a logCat help you in any way to determine what's wrong?

I'm using the latest version from F-Droid (2.0.0), but previous versions also didn't use the dark theme for display, even though it was enabled in the settings.

@indywidualny
Copy link
Owner

Have a look please. It's extremely simple. After the page is loaded Java Script function is invoked to inject CSS read from a file:

view.loadUrl("javascript:function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; document.body.appendChild(node); } addStyleString('" + cssFile + "');");

Reading from file (method call):

cssFile = readRawTextFile(context, R.raw.black);

The main method (really simple) reading the file:

private static String readRawTextFile(Context ctx, int resId) {

I have no idea where something is wrong. I will add some log lines to it soon to make it easier to debug.

@sputtene
Copy link

sputtene commented Dec 2, 2015

I don't see anything wrong with your code either.

If you have a version with debug logging, I'd be happy to try it and post the logcat output.

I've started the application two times, once with the dark theme enabled and once with the dark theme disabled.
In the logcat of the first run (dark theme enabled), I see this:

I/BufferQueue(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41e63050,api:1) [release] fps:23.83, dur:1007.23, max:230.73, min:15.32
I/SurfaceTextureClient(13430): [STC::queueBuffer] (this:0x60ed18e8) fps:39.65, dur:1008.94, max:426.31, min:3.13
I/BufferQueue(13430): [unnamed-13430-0](this:0x60ed4008,api:2) [queue] fps:39.64, dur:1008.96, max:426.51, min:3.08
I/BufferQueue(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41de31e0,api:1) disconnect: api=1
I/SurfaceTexture(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity] [virtual android::status_t android::SurfaceTexture::forceAuxConversionLocked()] mCurrentTexture:0, mCurrentBuf:0x41e0e290
I/BufferQueue(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41de31e0,api:0) getReleasedBuffers: returning mask 0xffffffff
I/SurfaceTexture(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41ec3bf0,api:0) destroying EGLImage dpy=0x1 img=0x41c94f90
I/WindowManager(  559): Gaining focus: Window{41ecb338 u0 org.indywidualni.fblite/org.indywidualni.fblite.MainActivity}
I/WindowManager(  559): Losing focus: Window{41dad150 u0 org.indywidualni.fblite/org.indywidualni.fblite.MainActivity}
E/Web Console(13430): Uncaught SyntaxError: Unexpected token ILLEGAL at null:1
I/BufferQueue(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41de31e0,api:0) consumerDisconnect
I/BufferQueue(  130): [org.indywidualni.fblite/org.indywidualni.fblite.MainActivity](this:0x41de31e0,api:0) ~BufferQueue

That error is not there in the logcat when running with the dark theme disabled.

I hope this helps you to narrow down the problem.

@indywidualny
Copy link
Owner

Apparently everything is ok with the code. The error is caused by illegal characters in the CSS file. Great news, it's so easy to fix!

@sputtene
Copy link

sputtene commented Dec 2, 2015

That's good news :)

What illegal characters are you talking about? The CSS file is ASCII text. Do you mean there are syntax errors in your CSS?

It's interesting how Android <=4.2.2 doesn't work and more recent versions do work. Maybe the WebView widget was changed to be more forgiving in later versions of Android?

@indywidualny
Copy link
Owner

I copied some parts of the CSS file from a few sources, maybe something is illegal, some non printable characters... It shouldn't be but... No idea for now. The file is the problem for sure. The file is used to create this JS function. I remember a similar error when there was a syntax error in another JS function.

One thing is strange for sure. Why is it working for newer Android versions? :D

@sputtene
Copy link

sputtene commented Dec 2, 2015

The latest version at this moment (https://github.com/indywidualny/FaceSlim/blob/f479edc507041bc0bcca8d356d750420c5e0a239/app/src/main/res/raw/black.css) has no strange characters.
The only non-printable character is 0x0A, which is a newline and that is not illegal :)

I'll see if I can persuade Web Core to generate more detailed logging. Maybe that can tell us what exact part of the CSS file it doesn't like.

@indywidualny
Copy link
Owner

New lines seem to be a problem here - http://stackoverflow.com/a/12702807/4388718

This line has to be removed:

I will do so and send you a fixed package to test it.

@sputtene
Copy link

sputtene commented Dec 2, 2015

Either remove that line or change https://github.com/indywidualny/FaceSlim/blob/master/app/src/main/java/org/indywidualni/fblite/MyAppWebViewClient.java#L83 so it wraps str in double quotes instead of single quotes.
That should also work according to the comments on your SO link.

Anyway, I'd be glad to test a fixed package and report success/failure.

@indywidualny
Copy link
Owner

@sputtene
Copy link

sputtene commented Dec 2, 2015

It works! :D

@indywidualny
Copy link
Owner

Awesome! Thanks for help. I wouldn't do anything without your logs.
It's gonna be released soon. New release is almost ready.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants