AsyncTask cancel handling
This commit is contained in:
parent
82fb6e7698
commit
3f741f774f
|
@ -137,9 +137,6 @@ public class MainActivity extends AppCompatActivity implements OnRefreshListener
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
if (home != null && home.getStatus() == RUNNING) {
|
if (home != null && home.getStatus() == RUNNING) {
|
||||||
home.cancel(true);
|
home.cancel(true);
|
||||||
timelineReload.setRefreshing(false);
|
|
||||||
trendReload.setRefreshing(false);
|
|
||||||
mentionReload.setRefreshing(false);
|
|
||||||
}
|
}
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
@ -174,6 +171,7 @@ public class MainActivity extends AppCompatActivity implements OnRefreshListener
|
||||||
startActivity(search);
|
startActivity(search);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String s) {
|
public boolean onQueryTextChange(String s) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -257,24 +255,26 @@ public class MainActivity extends AppCompatActivity implements OnRefreshListener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
if (home != null && home.getStatus() == RUNNING)
|
||||||
|
home.cancel(true);
|
||||||
home = new MainPage(MainActivity.this);
|
home = new MainPage(MainActivity.this);
|
||||||
if (tabIndex == 0)
|
|
||||||
|
switch (tabIndex) {
|
||||||
|
case 0:
|
||||||
home.execute(MainPage.HOME, 1);
|
home.execute(MainPage.HOME, 1);
|
||||||
else if (tabIndex == 1)
|
break;
|
||||||
|
case 1:
|
||||||
home.execute(MainPage.TRND, 1);
|
home.execute(MainPage.TRND, 1);
|
||||||
else if (tabIndex == 2)
|
break;
|
||||||
|
case 2:
|
||||||
home.execute(MainPage.MENT, 1);
|
home.execute(MainPage.MENT, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabChanged(String tabId) {
|
public void onTabChanged(String tabId) {
|
||||||
if (home != null && home.getStatus() == RUNNING) {
|
|
||||||
home.cancel(true);
|
|
||||||
timelineReload.setRefreshing(false);
|
|
||||||
trendReload.setRefreshing(false);
|
|
||||||
mentionReload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
animate();
|
animate();
|
||||||
tabIndex = tabhost.getCurrentTab();
|
tabIndex = tabhost.getCurrentTab();
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
|
@ -130,6 +130,12 @@ public class ImagePopup extends AsyncTask<String, Void, Boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Boolean b) {
|
||||||
|
popup.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setImage(Bitmap btm, ImageView mImg) {
|
private void setImage(Bitmap btm, ImageView mImg) {
|
||||||
if (btm != null) {
|
if (btm != null) {
|
||||||
int height = (int) (btm.getHeight() / (btm.getWidth() / 640.0));
|
int height = (int) (btm.getHeight() / (btm.getWidth() / 640.0));
|
||||||
|
|
|
@ -157,4 +157,18 @@ public class MainPage extends AsyncTask<Integer, Integer, Integer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Integer i) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout timelineRefresh = ui.get().findViewById(R.id.timeline);
|
||||||
|
SwipeRefreshLayout trendRefresh = ui.get().findViewById(R.id.trends);
|
||||||
|
SwipeRefreshLayout mentionRefresh = ui.get().findViewById(R.id.mention);
|
||||||
|
|
||||||
|
timelineRefresh.setRefreshing(false);
|
||||||
|
trendRefresh.setRefreshing(false);
|
||||||
|
mentionRefresh.setRefreshing(false);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -83,12 +83,13 @@ public class MessageLoader extends AsyncTask<Long, Void, Long> {
|
||||||
protected void onPostExecute(Long mode) {
|
protected void onPostExecute(Long mode) {
|
||||||
if (ui.get() == null) return;
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
mAdapter.setData(message);
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||||
mRefresh.setRefreshing(false);
|
mRefresh.setRefreshing(false);
|
||||||
|
|
||||||
if (mode == FAIL) {
|
if (mode != FAIL) {
|
||||||
|
mAdapter.setData(message);
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
} else {
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case 420:
|
case 420:
|
||||||
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
|
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -104,4 +105,13 @@ public class MessageLoader extends AsyncTask<Long, Void, Long> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Long l) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||||
|
mRefresh.setRefreshing(false);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -90,4 +90,10 @@ public class MessageUpload extends AsyncTask<String, Void, Boolean> {
|
||||||
Toast.makeText(ui.get(), R.string.error_sending_dm, Toast.LENGTH_SHORT).show();
|
Toast.makeText(ui.get(), R.string.error_sending_dm, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Boolean b) {
|
||||||
|
popup.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -35,16 +35,14 @@ import twitter4j.TwitterException;
|
||||||
|
|
||||||
public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||||
|
|
||||||
// GET USER TWEETS
|
|
||||||
private static final long GET_USER = 1;
|
|
||||||
public static final long GET_TWEETS = 2;
|
public static final long GET_TWEETS = 2;
|
||||||
public static final long GET_FAVORS = 3;
|
public static final long GET_FAVORS = 3;
|
||||||
|
|
||||||
// USER ACTION
|
// USER ACTION
|
||||||
public static final long ACTION_FOLLOW = 6;
|
public static final long ACTION_FOLLOW = 6;
|
||||||
public static final long ACTION_BLOCK = 4;
|
public static final long ACTION_BLOCK = 4;
|
||||||
public static final long ACTION_MUTE = 5;
|
public static final long ACTION_MUTE = 5;
|
||||||
|
// GET USER TWEETS
|
||||||
|
private static final long GET_USER = 1;
|
||||||
// INTERN FLAGS
|
// INTERN FLAGS
|
||||||
private static final long FAILURE = -1;
|
private static final long FAILURE = -1;
|
||||||
|
|
||||||
|
@ -270,11 +268,6 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||||
protected void onPostExecute(final Long MODE) {
|
protected void onPostExecute(final Long MODE) {
|
||||||
if (ui.get() == null) return;
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
|
||||||
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
|
||||||
homeReload.setRefreshing(false);
|
|
||||||
favReload.setRefreshing(false);
|
|
||||||
|
|
||||||
if (MODE == ACTION_FOLLOW) {
|
if (MODE == ACTION_FOLLOW) {
|
||||||
if (isFollowing)
|
if (isFollowing)
|
||||||
Toast.makeText(ui.get(), R.string.followed, Toast.LENGTH_SHORT).show();
|
Toast.makeText(ui.get(), R.string.followed, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -294,6 +287,10 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||||
Toast.makeText(ui.get(), R.string.unmuted, Toast.LENGTH_SHORT).show();
|
Toast.makeText(ui.get(), R.string.unmuted, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
} else if (MODE == FAILURE) {
|
} else if (MODE == FAILURE) {
|
||||||
|
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
||||||
|
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
||||||
|
homeReload.setRefreshing(false);
|
||||||
|
favReload.setRefreshing(false);
|
||||||
|
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case 420:
|
case 420:
|
||||||
|
@ -312,4 +309,16 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||||
ui.get().invalidateOptionsMenu();
|
ui.get().invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Long mode) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
||||||
|
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
||||||
|
homeReload.setRefreshing(false);
|
||||||
|
favReload.setRefreshing(false);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -249,4 +249,13 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Long l) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout ansReload = ui.get().findViewById(R.id.answer_reload);
|
||||||
|
ansReload.setRefreshing(false);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -109,4 +109,10 @@ public class StatusUpload extends AsyncTask<String, Void, Boolean> {
|
||||||
.setNegativeButton(R.string.cancel, null).show();
|
.setNegativeButton(R.string.cancel, null).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Boolean b) {
|
||||||
|
popup.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -99,10 +99,10 @@ public class TwitterSearch extends AsyncTask<String, Integer, Boolean> {
|
||||||
protected void onPostExecute(Boolean success) {
|
protected void onPostExecute(Boolean success) {
|
||||||
if (ui.get() == null) return;
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
SwipeRefreshLayout tweetReload = ui.get().findViewById(R.id.searchtweets);
|
SwipeRefreshLayout tweetReload = ui.get().findViewById(R.id.searchtweets);
|
||||||
tweetReload.setRefreshing(false);
|
tweetReload.setRefreshing(false);
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case 420:
|
case 420:
|
||||||
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_LONG).show();
|
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_LONG).show();
|
||||||
|
@ -112,4 +112,13 @@ public class TwitterSearch extends AsyncTask<String, Integer, Boolean> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Boolean b) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout tweetReload = ui.get().findViewById(R.id.searchtweets);
|
||||||
|
tweetReload.setRefreshing(false);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package org.nuclearfog.twidda.backend;
|
package org.nuclearfog.twidda.backend;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
@ -69,10 +68,12 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
protected void onPostExecute(Boolean success) {
|
protected void onPostExecute(Boolean success) {
|
||||||
if (ui.get() == null) return;
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
|
SwipeRefreshLayout refresh = ui.get().findViewById(R.id.user_refresh);
|
||||||
|
refresh.setRefreshing(false);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
usrAdp.setData(user);
|
usrAdp.setData(user);
|
||||||
usrAdp.notifyDataSetChanged();
|
usrAdp.notifyDataSetChanged();
|
||||||
|
@ -85,6 +86,13 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
|
||||||
Toast.makeText(ui.get(), errorMessage, Toast.LENGTH_SHORT).show();
|
Toast.makeText(ui.get(), errorMessage, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Boolean b) {
|
||||||
|
if (ui.get() == null) return;
|
||||||
|
|
||||||
SwipeRefreshLayout refresh = ui.get().findViewById(R.id.user_refresh);
|
SwipeRefreshLayout refresh = ui.get().findViewById(R.id.user_refresh);
|
||||||
refresh.setRefreshing(false);
|
refresh.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,18 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public abstract class Tagger {
|
public abstract class Tagger {
|
||||||
|
|
||||||
private static final String PATTERN = "[@#][^\\s@#\\.\\,]+";
|
private static final String PATTERN = "[@#][^\\s@#\\.\\,\\!\\?]+";
|
||||||
private static final int MODE = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
|
private static final int MODE = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a spannable colored String with click listener
|
||||||
|
*
|
||||||
|
* @param text String that should be spannable
|
||||||
|
* @param color Text Color
|
||||||
|
* @param l click listener
|
||||||
|
* @return Spannable String
|
||||||
|
*/
|
||||||
public static Spannable makeText(final String text, final int color, @NonNull final OnTagClickListener l) {
|
public static Spannable makeText(final String text, final int color, @NonNull final OnTagClickListener l) {
|
||||||
SpannableStringBuilder sText = new SpannableStringBuilder(text);
|
SpannableStringBuilder sText = new SpannableStringBuilder(text);
|
||||||
Pattern p = Pattern.compile(PATTERN);
|
Pattern p = Pattern.compile(PATTERN);
|
||||||
|
@ -42,6 +50,13 @@ public abstract class Tagger {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a spannable String without listener
|
||||||
|
*
|
||||||
|
* @param text String that should be spannable
|
||||||
|
* @param color Text Color
|
||||||
|
* @return Spannable String
|
||||||
|
*/
|
||||||
public static Spannable makeText(String text, int color) {
|
public static Spannable makeText(String text, int color) {
|
||||||
SpannableStringBuilder sText = new SpannableStringBuilder(text);
|
SpannableStringBuilder sText = new SpannableStringBuilder(text);
|
||||||
Pattern p = Pattern.compile(PATTERN);
|
Pattern p = Pattern.compile(PATTERN);
|
||||||
|
@ -56,7 +71,15 @@ public abstract class Tagger {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface definition of Tag click listener
|
||||||
|
*/
|
||||||
public interface OnTagClickListener {
|
public interface OnTagClickListener {
|
||||||
|
/**
|
||||||
|
* Called when a tag was clicked
|
||||||
|
*
|
||||||
|
* @param tag Clicked Tag
|
||||||
|
*/
|
||||||
void onClick(String tag);
|
void onClick(String tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -76,7 +76,7 @@ public class LoginPage extends AppCompatActivity implements OnClickListener {
|
||||||
|
|
||||||
case R.id.clipboard:
|
case R.id.clipboard:
|
||||||
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
if (clip != null && clip.hasPrimaryClip()) {
|
if (clip != null && clip.getPrimaryClip() != null) {
|
||||||
String text = clip.getPrimaryClip().getItemAt(0).getText().toString();
|
String text = clip.getPrimaryClip().getItemAt(0).getText().toString();
|
||||||
if (text.matches("\\d++\n?")) {
|
if (text.matches("\\d++\n?")) {
|
||||||
pin.setText(text);
|
pin.setText(text);
|
||||||
|
|
|
@ -113,10 +113,8 @@ public class SearchPage extends AppCompatActivity implements UserAdapter.OnItemC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
if (mSearch != null && mSearch.getStatus() == RUNNING) {
|
if (mSearch != null && mSearch.getStatus() == RUNNING)
|
||||||
mSearch.cancel(true);
|
mSearch.cancel(true);
|
||||||
tweetReload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,8 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
if (mStat != null && mStat.getStatus() == RUNNING) {
|
if (mStat != null && mStat.getStatus() == RUNNING)
|
||||||
mStat.cancel(true);
|
mStat.cancel(true);
|
||||||
answerReload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class TweetPopup extends AppCompatActivity implements OnClickListener {
|
||||||
if (imagePopup != null && imagePopup.getStatus() == RUNNING)
|
if (imagePopup != null && imagePopup.getStatus() == RUNNING)
|
||||||
imagePopup.cancel(true);
|
imagePopup.cancel(true);
|
||||||
imagePopup = new ImagePopup(this);
|
imagePopup = new ImagePopup(this);
|
||||||
imagePopup.execute(mediaPath.toArray(new String[mediaPath.size()]));
|
imagePopup.execute(mediaPath.toArray(new String[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,8 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked, OnRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
if (uList != null && uList.getStatus() == RUNNING) {
|
if (uList != null && uList.getStatus() == RUNNING)
|
||||||
uList.cancel(true);
|
uList.cancel(true);
|
||||||
refresh.setRefreshing(false);
|
|
||||||
}
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,8 @@ public class UserProfile extends AppCompatActivity implements OnRefreshListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
if (mProfile != null && mProfile.getStatus() == RUNNING) {
|
if (mProfile != null && mProfile.getStatus() == RUNNING)
|
||||||
mProfile.cancel(true);
|
mProfile.cancel(true);
|
||||||
homeReload.setRefreshing(false);
|
|
||||||
favoriteReload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,30 +262,34 @@ public class UserProfile extends AppCompatActivity implements OnRefreshListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
if (tabIndex == 0) {
|
if (mProfile != null && mProfile.getStatus() == RUNNING)
|
||||||
|
mProfile.cancel(true);
|
||||||
mProfile = new ProfileLoader(this);
|
mProfile = new ProfileLoader(this);
|
||||||
|
|
||||||
|
switch (tabIndex) {
|
||||||
|
case 0:
|
||||||
mProfile.execute(userId, ProfileLoader.GET_TWEETS, 1L);
|
mProfile.execute(userId, ProfileLoader.GET_TWEETS, 1L);
|
||||||
} else {
|
break;
|
||||||
mProfile = new ProfileLoader(this);
|
case 1:
|
||||||
mProfile.execute(userId, ProfileLoader.GET_FAVORS, 1L);
|
mProfile.execute(userId, ProfileLoader.GET_FAVORS, 1L);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabChanged(String tabId) {
|
public void onTabChanged(String tabId) {
|
||||||
if (mProfile != null && mProfile.getStatus() == RUNNING) {
|
|
||||||
mProfile.cancel(true);
|
|
||||||
homeReload.setRefreshing(false);
|
|
||||||
favoriteReload.setRefreshing(false);
|
|
||||||
}
|
|
||||||
animate();
|
animate();
|
||||||
tabIndex = mTab.getCurrentTab();
|
|
||||||
|
|
||||||
if (tabIndex == 0)
|
switch (tabIndex) {
|
||||||
favoriteList.smoothScrollToPosition(0);
|
case 0:
|
||||||
else
|
|
||||||
homeList.smoothScrollToPosition(0);
|
homeList.smoothScrollToPosition(0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
favoriteList.smoothScrollToPosition(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tabIndex = mTab.getCurrentTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue