Mar 7 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
midas | has entered the room |
midas |
hey mark
|
Mark M. |
hello, midas!
|
Mark M. |
how can I help you today>
|
Mark M. |
er, today?
|
midas |
well I have an interesting new requirement in my companies app
|
midas |
wanted to get your advice
|
midas |
the company wants both android and ios teams
|
midas |
to download a js script
|
Mar 7 | 4:00 PM |
midas |
which contains logic that needs to be executed
|
midas |
relatively frquently
|
midas |
I have been having a hard time just downloading the file itseld
|
midas |
*itself
|
midas |
I get the byte[]
|
midas |
and try to convert it into a string
|
midas |
and get gibberish
|
midas |
I think that once I get the stringified js Ill be ok
|
Mark M. |
well, if you're using OkHttp, you can get the response body as a string
|
midas |
so the question is how to convert the byte [] into a .js file
|
Ed T. | has entered the room |
Mark M. |
how are you downloading it?
|
midas |
I am currently not using okhttp
|
Mark M. |
(BTW, hello Ed -- I will be with you shortly!)
|
midas |
networking lib is volley
|
midas |
(it was there when I got the project)
|
midas |
internally it uses HURLConnection (I think)
|
Mark M. |
then use StringRequest
|
midas |
same issue
|
midas |
gibberish
|
midas |
I think that the issue is that its converting the file headers also
|
Mark M. |
"file headers"?
|
midas |
for example
|
midas |
I see the file name in the gibberish
|
midas |
which is not in the content
|
Mark M. |
my guess is that there is some issue with the server and how it is serving the response
|
midas |
well the ios guy got it to work
|
midas |
so I dont think thats it
|
midas |
also I can load the js in a browser
|
Mark M. |
that may just mean that iOS is friendlier to broken servers than is HURLConnection
|
midas |
its hosted on s3
|
Mar 7 | 4:05 PM |
Mark M. |
I don't know what to tell you
|
Mark M. |
lots of people use StringRequest
|
midas |
for .js files?
|
Mark M. |
that should not matter
|
midas |
I didnt think so either
|
Mark M. |
unless S3 is doing something strange when publishing such files
|
midas |
well thanks anyway
|
Mark M. |
you might set up a scrap project and try other clients (e.g., OkHttp) and see if you have better luck
|
midas |
I will now resume banging my head into my keyboard
|
Mark M. |
I don't recommend that -- it's hard on the keyboard
|
Mark M. |
:-)
|
Ed T. |
lol
|
midas |
yeah I have been pushing to move to Retrofit for a while now
|
Mark M. |
let me take a question from Ed, and I'll be back with you shortly
|
Mark M. |
Ed: your turn! do you have a question?
|
Ed T. |
ty
|
midas |
thanks anyway Mark
|
Ed T. |
yes sir
|
Ed T. |
it should be 'easy' and I did Java Swing for 10 years
|
Ed T. |
but wow
|
Ed T. |
can you advise me on the best approach for formatting text in a TextView dynamically ?
|
Ed T. |
this was much easier in iOS and Java Swing
|
Mark M. |
what exactly do you mean by formatting? bold, italic, etc.?
|
Ed T. |
no, I consider that a Font attribute
|
Ed T. |
so I want an edit mask like... (xxx) xxx-xxxx
|
Ed T. |
or you type in a number and as you type... I adjust it dynamically for xxx,xxx,xxx
|
Mark M. | |
Mark M. |
or, even better, https://android-arsenal.com/search?q=mask
|
Ed T. |
NICE!
|
Mar 7 | 4:10 PM |
Mark M. |
with luck, the particular masks that you want are supported by 1+ of the libraries
|
Ed T. |
you're the best $20 I spend... just saying
|
Ed T. |
:)
|
Ed T. |
thanks!
|
Mark M. |
thanks for the kind words! though I think that you're forgetting that one really awesome pizza that you ordered...
|
Mark M. |
anyway, even if what you want isn't directly supported, you can use those as inspiration
|
Mark M. |
most probably use TextWatcher
|
Ed T. |
Thanks again Mark. Cheers
|
Mark M. |
let me take a question from midas, and I'll swing back to you in a bit
|
Mark M. |
midas: your turn! do you have another question?
|
Ed T. |
I'm good, cheers
|
Ed T. | has left the room |
Mar 7 | 4:20 PM |
midas | has left the room |
Mar 7 | 5:00 PM |
Mark M. | turned off guest access |