grzegorznittner / chanu

Chanu - 4chan for Android
https://play.google.com/store/apps/details?id=com.chanapps.four.activity
GNU General Public License v3.0
74 stars 32 forks source link

Slow Board Loading #436

Closed yate closed 9 years ago

yate commented 9 years ago

The first time a board is loaded it is pretty slow. What I've found is that BoardActivity and other classes are calling refresh() and onRefresh() multiple times, something like 4 or 5. I'm having trouble figuring out which ones are necessary and which ones can be removed, if any.

Any ideas? I'll continue to experiment around.

johnarleyburns commented 9 years ago

I think just comment them out and then see what happens. The refresh() and onRefresh() method should be combined I think. It worked fine when it was "fully manual", I think I screwed it up when I tried to make it automatically refresh. So in short, the problem is all with the auto-refresh calculations, it's screwed up.

On Thu, Dec 4, 2014 at 2:47 PM, yate notifications@github.com wrote:

The first time a board is loaded it is pretty slow. What I've found is that BoardActivity and other classes are calling refresh() and onRefresh() multiple times, something like 4 or 5. I'm having trouble figuring out which ones are necessary and which ones can be removed, if any.

Any ideas? I'll continue to experiment around.

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436.

yate commented 9 years ago

I got rid of one call and things seems to be working okay. A couple questions:

Do you know where the automatic refresh job is set up in the code? Where are the dark icons for the "View Options" list. They are white using the dark theme in Lollipop and I'm struggling to find out where they are.

johnarleyburns commented 9 years ago
  1. Auto Refresh Code

Are you talking about thread refresh or board refresh? These are two different things. Thread Refresh is in ThreadFragment.java:

protected final Runnable autoUpdateRunnable = new Runnable() { @Override public void run() { if (DEBUG) Log.i(TAG, "autoUpdateRunnable preparing refresh /"

It's scheduled to run in method "scheduleAutoUpdate()" which is called in onStart().

  1. View Options Icon

So the View Options icons are copied directly from the "android-design-resources" folder:

android-design-resources\Icons\All_Icons\holo_light\xhdpi\4_collections_view_as_grid.png

They are renamed "collections_view_as_grid.png" because android doesn't allow icons to start with a number.

I think I just forgot to include the dark icons, so what you can do is copy the same 4_collections_view_as_grid.png for each size from the android design resources "holo_dark" folder for each screen density, and update the code to use them for the dark theme. This means you have to "themize" the pref_view_options icon in thread_menu.xml and board_menu.xml. If you have trouble let me know.

  1. BTW I issued the new release yesterday and f-droid still didn't pick it up, I'm not sure if they're just being really slow or if we did something wrong.

On Thu, Dec 11, 2014 at 9:49 PM, yate notifications@github.com wrote:

I got rid of one call and things seems to be working okay. A couple questions:

Do you know where the automatic refresh job is set up in the code? Where are the dark icons for the "View Options" list. They are white using the dark theme in Lollipop and I'm struggling to find out where they are.

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66729039 .

yate commented 9 years ago

Thanks! F-droid is slow because they have to manually add the new metadata :(. But our new release was detected and it should be added soon. You can see it on the apps to update page and under the version section

yate commented 9 years ago

Darn the captcha fix isn't working anymore

johnarleyburns commented 9 years ago

2.0.6 works for me On Dec 12, 2014 3:25 PM, "yate" notifications@github.com wrote:

Darn the captcha fix isn't working anymore

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66837746 .

yate commented 9 years ago

Really, maybe in just horrible at entering captchas but I still can't post on /g/ :o. On Dec 14, 2014 9:26 AM, "John Burns" notifications@github.com wrote:

2.0.6 works for me On Dec 12, 2014 3:25 PM, "yate" notifications@github.com wrote:

Darn the captcha fix isn't working anymore

— Reply to this email directly or view it on GitHub < https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66837746>

.

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66914800 .

johnarleyburns commented 9 years ago

was testing on /b/, doesnt work anywhere else On Dec 14, 2014 9:34 AM, "yate" notifications@github.com wrote:

Really, maybe in just horrible at entering captchas but I still can't post on /g/ :o. On Dec 14, 2014 9:26 AM, "John Burns" notifications@github.com wrote:

2.0.6 works for me On Dec 12, 2014 3:25 PM, "yate" notifications@github.com wrote:

Darn the captcha fix isn't working anymore

— Reply to this email directly or view it on GitHub <

https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66837746>

.

— Reply to this email directly or view it on GitHub < https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66914800>

.

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66916828 .

yate commented 9 years ago

Sad :(. I'll be able to look later tonight On Dec 14, 2014 10:42 AM, "John Burns" notifications@github.com wrote:

was testing on /b/, doesnt work anywhere else On Dec 14, 2014 9:34 AM, "yate" notifications@github.com wrote:

Really, maybe in just horrible at entering captchas but I still can't post on /g/ :o. On Dec 14, 2014 9:26 AM, "John Burns" notifications@github.com wrote:

2.0.6 works for me On Dec 12, 2014 3:25 PM, "yate" notifications@github.com wrote:

Darn the captcha fix isn't working anymore

— Reply to this email directly or view it on GitHub <

https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66837746>

.

— Reply to this email directly or view it on GitHub <

https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66914800>

.

— Reply to this email directly or view it on GitHub < https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66916828>

.

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-66917066 .

yate commented 9 years ago

The captcha is working but only for two word ones it seems. I probably screwed up the input somewhere

yate commented 9 years ago

Actually probably because its doubling the input even if it's supposed to be one.

    public String getRecaptchaResponse() {
        String t = recaptchaText.getText().toString();
        if (t.indexOf(" ") == -1) // autodoubling for quick entry
        t = t + " " + t;
        return t;
    }
johnarleyburns commented 9 years ago

it should only do this when you have two for the source, it makes it so you dont have to enter both On Dec 16, 2014 5:05 PM, "yate" notifications@github.com wrote:

Actually probably because its doubling the input even if it's supposed to be one.

public String getRecaptchaResponse() {
    String t = recaptchaText.getText().toString();
    if (t.indexOf(" ") == -1) // autodoubling for quick entry
    t = t + " " + t;
    return t;
}

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-67249809 .

yate commented 9 years ago

by source do you mean the actual captcha image, or the text that they write?

johnarleyburns commented 9 years ago

it used to be you always had to write two words, but if you just wrote the captcha one i would copy it and it would work.

just comment that out if its breaking things On Dec 16, 2014 5:14 PM, "yate" notifications@github.com wrote:

by source do you mean the actual captcha image, or the text that they write?

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-67250788 .

yate commented 9 years ago

Okay yeah they must have changed it because I just got a one word captcha. When i entered it gave me "invalid captcha" but the next one was two words and it worked. I'll try commenting it out later when I get home

johnarleyburns commented 9 years ago

yeah im not getting any captchas to work in 2.0.7 On Dec 16, 2014 5:20 PM, "yate" notifications@github.com wrote:

Okay yeah they must have changed it because I just got a one word captcha. When i entered it gave me "invalid captcha" but the next one was two words and it worked. I'll try commenting it out later when I get home

— Reply to this email directly or view it on GitHub https://github.com/grzegorznittner/chanu/issues/436#issuecomment-67251530 .