use of com.klinker.android.twitter.adapters.TimelineArrayAdapter in project Talon-for-Twitter by klinker24.
the class ChoosenListActivity method onRefreshStarted.
public void onRefreshStarted() {
new Thread(new Runnable() {
@Override
public void run() {
try {
Twitter twitter = Utils.getTwitter(context, settings);
paging.setPage(1);
ResponseList<twitter4j.Status> lists = twitter.getUserListStatuses(listId, paging);
statuses.clear();
for (Status status : lists) {
statuses.add(status);
}
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
adapter = new TimelineArrayAdapter(context, statuses);
listView.setAdapter(adapter);
listView.setVisibility(View.VISIBLE);
spinner.setVisibility(View.GONE);
}
});
} catch (Exception e) {
e.printStackTrace();
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
mPullToRefreshLayout.setRefreshing(false);
}
});
}
}).start();
}
use of com.klinker.android.twitter.adapters.TimelineArrayAdapter in project Talon-for-Twitter by klinker24.
the class ChoosenListActivity method getLists.
public void getLists() {
canRefresh = false;
new Thread(new Runnable() {
@Override
public void run() {
try {
Twitter twitter = Utils.getTwitter(context, settings);
ResponseList<twitter4j.Status> lists = twitter.getUserListStatuses(listId, paging);
paging.setPage(paging.getPage() + 1);
for (Status status : lists) {
statuses.add(status);
}
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
if (adapter == null) {
adapter = new TimelineArrayAdapter(context, statuses);
listView.setAdapter(adapter);
listView.setVisibility(View.VISIBLE);
} else {
adapter.notifyDataSetChanged();
}
spinner.setVisibility(View.GONE);
canRefresh = true;
}
});
} catch (Exception e) {
e.printStackTrace();
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
spinner.setVisibility(View.GONE);
canRefresh = false;
}
});
} catch (OutOfMemoryError e) {
e.printStackTrace();
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
spinner.setVisibility(View.GONE);
canRefresh = false;
}
});
}
}
}).start();
}
Aggregations