|
|
@ -19,19 +19,19 @@ package org.floens.chan.ui.view; |
|
|
|
|
|
|
|
|
|
|
|
import org.floens.chan.core.loader.Loader; |
|
|
|
import org.floens.chan.core.loader.Loader; |
|
|
|
import org.floens.chan.core.manager.ThreadManager; |
|
|
|
import org.floens.chan.core.manager.ThreadManager; |
|
|
|
|
|
|
|
import org.floens.chan.ui.adapter.PostAdapter; |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context; |
|
|
|
import android.content.Context; |
|
|
|
import android.os.Handler; |
|
|
|
import android.os.Handler; |
|
|
|
import android.util.AttributeSet; |
|
|
|
import android.util.AttributeSet; |
|
|
|
import android.view.View; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.BaseAdapter; |
|
|
|
|
|
|
|
import android.widget.ListView; |
|
|
|
import android.widget.ListView; |
|
|
|
import android.widget.TextView; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
|
|
|
|
public class ThreadWatchCounterView extends TextView implements View.OnClickListener { |
|
|
|
public class ThreadWatchCounterView extends TextView implements View.OnClickListener { |
|
|
|
private boolean detached = false; |
|
|
|
private boolean detached = false; |
|
|
|
private ThreadManager tm; |
|
|
|
private ThreadManager tm; |
|
|
|
private BaseAdapter ad; |
|
|
|
private PostAdapter ad; |
|
|
|
|
|
|
|
|
|
|
|
public ThreadWatchCounterView(Context activity) { |
|
|
|
public ThreadWatchCounterView(Context activity) { |
|
|
|
super(activity); |
|
|
|
super(activity); |
|
|
@ -45,7 +45,7 @@ public class ThreadWatchCounterView extends TextView implements View.OnClickList |
|
|
|
super(activity, attbs, style); |
|
|
|
super(activity, attbs, style); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void init(final ThreadManager threadManager, final ListView listView, final BaseAdapter adapter) { |
|
|
|
public void init(final ThreadManager threadManager, final ListView listView, final PostAdapter adapter) { |
|
|
|
tm = threadManager; |
|
|
|
tm = threadManager; |
|
|
|
ad = adapter; |
|
|
|
ad = adapter; |
|
|
|
|
|
|
|
|
|
|
@ -89,10 +89,15 @@ public class ThreadWatchCounterView extends TextView implements View.OnClickList |
|
|
|
|
|
|
|
|
|
|
|
int time = Math.round(loader.getTimeUntilLoadMore() / 1000f); |
|
|
|
int time = Math.round(loader.getTimeUntilLoadMore() / 1000f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String error = ad.getErrorMessage(); |
|
|
|
|
|
|
|
if (error != null) { |
|
|
|
|
|
|
|
setText(error); |
|
|
|
|
|
|
|
} else { |
|
|
|
if (time <= 0) { |
|
|
|
if (time <= 0) { |
|
|
|
setText("Loading"); |
|
|
|
setText("Loading"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setText("Loading in " + time); |
|
|
|
setText("Loading in " + time); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|