itkach / aard2-android

Aard2 for Android, a simple dictionary app
GNU General Public License v3.0
426 stars 98 forks source link

My userstyle "Doesn't appear to be a CSS file" #131

Closed BraveSentry closed 2 years ago

BraveSentry commented 2 years ago

I have the css code below in a file, ending in .css. When I try to import it into my userstyles (using the + symbol in the settings menu an selecting the file with androids file manager), aard2 gives me "Doesn't appear to be a CSS file". Can I do anything to make it recognize the file?

This happens on Android 11 on a Fairphone4 with aard2 version 0.46.

body {   
background-color: black;   
color: white;
}
h1, h2, h3, h4, h5, h6 {   
color: white !important;
}
.mjx-svg-mrow {   
fill: white;   
stroke: white;
}
img {   
background-color: lightgray;
}
table {   
background-color: black !important;   
color: white !important;
}
table tr td {
color: #888;
}
table tr td a {
color:  #aad;
}
table tr th span a {
color:  #99f;
}
table tbody tr th {
color:  #888;
}
table.translations td {   
background-color: #191919;
}
table.translations {   
border-collapse: collapse;
}
.wikitable th {   
background-color: #292929 !important;
}
div.thumbinner {   
background-color: #191919 !important;
}
div.thumb {   
border-color: black !important;
}
a {   
/*color: #A3964E;*/
color:  #CCF;
}
a:visited {   
/*color: #735A0A;*/   
color: #AAF;
}
a.new { 
color:  #E88;
}
.toc {   
background-color: #443 !important;
}
code {
background-color: darkgreen;
}
itkach commented 2 years ago

The code only checks that file path ends with .css or .txt. Perhaps the path the system returns does not actually point to the file for some reason... Data uri for selected file is logged, might be helpful to check logging output. Also maybe try moving css file to a different location and open from there.

BraveSentry commented 2 years ago

Moving the file did the trick, thanks for the hint!

itkach commented 2 years ago

I ran into this too, looks like Android 11 no longer uses file path as URI, so the check based on extension fails. I'm now surprised that moving the file actually made a difference. In any case, this should be fixed now in d84b375ba2bde079e4d5dcc30475db29fc025c0a